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 argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() ...
610
"""simple docstring""" from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowercase__ = {"""UserAgent""": UserAgent().random} def __lowerCamelCase ( __UpperCamelCase ) -> dict: """simple docstrin...
610
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available lowercase__ = { """configuration_gpt_neo""": ["""GPT_NEO_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GPTNeoConfig""", """GPTNeoOnnxConfig"""], }...
610
"""simple docstring""" import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import Token...
610
1
"""simple docstring""" from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __lowerCamelCase ( A__ ...
610
"""simple docstring""" from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be chec...
610
1
"""simple docstring""" from collections.abc import Callable import numpy as np def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ) -> np.array: """simple docstring""" lowerCAmelCase_ : str ...
610
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ) -> float: """simple docstring""" return round(float(moles / volume ) * nfactor ) def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __Upp...
610
1
"""simple docstring""" import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import AdamW from to...
610
"""simple docstring""" import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from...
610
1
"""simple docstring""" from __future__ import annotations def __lowerCamelCase ( __UpperCamelCase ) -> list[int]: """simple docstring""" lowerCAmelCase_ : Any = [True] * limit lowerCAmelCase_ : Optional[Any] = False lowerCAmelCase_ : ...
610
"""simple docstring""" from typing import Any def __lowerCamelCase ( __UpperCamelCase ) -> list[Any]: """simple docstring""" if not input_list: return [] lowerCAmelCase_ : Any = [input_list.count(__UpperCamelCase ) for value in input_list] lowerCAme...
610
1
"""simple docstring""" import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class __lowerCamelCase ( A__ ): '''simple docstring''' a_ : List[str] = """""" a_ ...
610
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils impo...
610
1
"""simple docstring""" import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from...
610
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase__ = { """configuration...
610
1
"""simple docstring""" from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_torch_available(): import torch if is_torch_tpu...
610
"""simple docstring""" lowercase__ = """ # Transformers 설치 방법 ! pip install transformers datasets # 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요. # ! pip install git+https://github.com/huggingface/transformers.git """ lowercase__ = [{"""type""": """code""", """content""": INSTALL_CONTENT}...
610
1
"""simple docstring""" import csv import tweepy # Twitter API credentials lowercase__ = """""" lowercase__ = """""" lowercase__ = """""" lowercase__ = """""" def __lowerCamelCase ( __UpperCamelCase ) -> None: """simple docstring""" lowerCAmel...
610
"""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 ...
610
1
"""simple docstring""" from ..utils import DummyObject, requires_backends class __lowerCamelCase ( metaclass=A__ ): '''simple docstring''' a_ : Optional[Any] = ["""speech"""] def __init__( self : int , *a_ : int , **a_ : ...
610
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase ) -> tuple[int, int]: """simple docstring""" try: lowerCAmelCase_ : Tuple = float(__UpperCamelCase ) except ValueError: raise ValueError("Please enter a valid number" ) lowerCAmelCa...
610
1
"""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/LICENSE-...
610
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase ) -> int: """simple docstring""" return 1 if input_a == input_a else 0 def __lowerCamelCase ( ) -> None: """simple docstring""" assert xnor_gate(0 , 0 ) ==...
610
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available lowercase__ = { """configuration_longt5""": ["""LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LongT5Config""", """LongT5OnnxConfig"""], } ...
610
"""simple docstring""" from typing import Optional, Tuple, Union import tensorflow as tf from ...activations_tf import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward from ...modeling_tf_outputs import ( TFBaseModelOutputWithNoAttent...
610
1
"""simple docstring""" import logging import os from typing import List, Tuple import numpy as np import psutil import torch import torch.distributed as dist from transformers import RagRetriever lowercase__ = logging.getLogger(__name__) class __lowerCamelCase ( A__ ): '...
610
"""simple docstring""" import math def __lowerCamelCase ( __UpperCamelCase ) -> int: """simple docstring""" if not isinstance(__UpperCamelCase , __UpperCamelCase ): lowerCAmelCase_ : Any = f'''Input value of [number={number}] must be an integer''' ...
610
1
"""simple docstring""" import numpy # List of input, output pairs lowercase__ = ( ((5, 2, 3), 15), ((6, 5, 9), 25), ((11, 12, 13), 41), ((1, 1, 1), 8), ((11, 12, 13), 41), ) lowercase__ = (((515, 22, 13), 555), ((61, 35, 49), 150)) lowercase__ = [2, 4, 1, 5] lowercas...
610
"""simple docstring""" import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import Tenso...
610
1
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils impo...
610
"""simple docstring""" import unittest import numpy as np import torch from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad class __lowerCamelCase ( unittest.TestCase ): '''simple docstring''' def lowerCamelCase ( self ...
610
1
"""simple docstring""" from __future__ import annotations import pandas as pd def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ) -> list[int]: """simple docstring""" lowerCAmelCase_ : Dict = [0] * no_of_processes lowerCAmel...
610
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_flax_available, is_torch_available, is_transformers_available, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyN...
610
1
"""simple docstring""" import json import os from dataclasses import dataclass from functools import partial from typing import Callable import flax.linen as nn import jax import jax.numpy as jnp import joblib import optax import wandb from flax import jax_utils, struct, traverse_util from flax.serialization i...
610
"""simple docstring""" import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __lowerCamelCase ...
610
1
"""simple docstring""" import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { """vocab_file""": """vocab.json""", """tokenizer_...
610
"""simple docstring""" # Lint as: python3 import itertools import os import re lowercase__ = re.compile(r"""([A-Z]+)([A-Z][a-z])""") lowercase__ = re.compile(r"""([a-z\d])([A-Z])""") lowercase__ = re.compile(r"""(?<!_)_(?!_)""") lowercase__ = re.compile(r"""(_{2,})""") lowerc...
610
1
"""simple docstring""" import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging lowercase__ = """\ """ lowercase__ = """ Perplexity (PPL) is one of the most common metrics ...
610
"""simple docstring""" import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class __lowerCamelCase ( A__ , A__ ): '''simple docstring''' @register_to_config def __init__( self : ...
610
1
"""simple docstring""" lowercase__ = """ # Transformers 설치 방법 ! pip install transformers datasets # 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요. # ! pip install git+https://github.com/huggingface/transformers.git """ lowercase__ = [{"""type""": """code""", """content""": INSTALL_CONTENT}...
610
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase ) -> str: """simple docstring""" return "".join([hex(__UpperCamelCase )[2:].zfill(2 ).upper() for byte in list(__UpperCamelCase )] ) def __lowerCamelCase ( __UpperCamelCase ) -> byte...
610
1
"""simple docstring""" import math def __lowerCamelCase ( __UpperCamelCase ) -> int: """simple docstring""" if not isinstance(__UpperCamelCase , __UpperCamelCase ): lowerCAmelCase_ : Any = f'''Input value of [number={number}] must be an integer''' ...
610
"""simple docstring""" import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING, B...
610
1
"""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/LICENSE-...
610
"""simple docstring""" from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowercase__ = {"""UserAgent""": UserAgent().random} def __lowerCamelCase ( __UpperCamelCase ) -> dict: """simple docstrin...
610
1
"""simple docstring""" # HF Trainer benchmarking tool # # This tool can be used to run and compare multiple dimensions of the HF Trainers args. # # It then prints a report once in github format with all the information that needs to be shared # with others and second time in a console-friendly format, so it's e...
610
"""simple docstring""" import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import Token...
610
1
"""simple docstring""" lowercase__ = { """A""": """.-""", """B""": """-...""", """C""": """-.-.""", """D""": """-..""", """E""": """.""", """F""": """..-.""", """G""": """--.""", """H""": """....""", """I""": """..""", """J""": """.---""", """K""": """-.-""", """L""": """.-..""", """M""": """--"...
610
"""simple docstring""" from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be chec...
610
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig class __lowerCamelCase ( A__ ): '''simple docstring''' a_ : List[Any] = """bert-generation""" def __init__( self : Dict , a_ : int=5_03_58 , a_ : ...
610
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ) -> float: """simple docstring""" return round(float(moles / volume ) * nfactor ) def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __Upp...
610
1
"""simple docstring""" import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedTokenizer,...
610
"""simple docstring""" import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from...
610
1
"""simple docstring""" import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class __lowerCamelCase ( A__ , A__ ): '''simple docstring''' @register_to_config def __init__( self : ...
610
"""simple docstring""" from typing import Any def __lowerCamelCase ( __UpperCamelCase ) -> list[Any]: """simple docstring""" if not input_list: return [] lowerCAmelCase_ : Any = [input_list.count(__UpperCamelCase ) for value in input_list] lowerCAme...
610
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_funnel import FunnelTokenizer lowercase__ = logging.get_logger(__name__) lowe...
610
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils impo...
610
1
"""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 lowercase__ = logging.get_logger(__name__) lowercase__ = ...
610
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase__ = { """configuration...
610
1
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { """Salesforce/blip-vqa-base""": """https://huggingface.co/Salesforce/blip-vqa-...
610
"""simple docstring""" lowercase__ = """ # Transformers 설치 방법 ! pip install transformers datasets # 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요. # ! pip install git+https://github.com/huggingface/transformers.git """ lowercase__ = [{"""type""": """code""", """content""": INSTALL_CONTENT}...
610
1
"""simple docstring""" import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup lowercase__ = { """User-Agent""": """Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36""" """ (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 ...
610
"""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 ...
610
1
"""simple docstring""" import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import Token...
610
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase ) -> tuple[int, int]: """simple docstring""" try: lowerCAmelCase_ : Tuple = float(__UpperCamelCase ) except ValueError: raise ValueError("Please enter a valid number" ) lowerCAmelCa...
610
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { ...
610
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase ) -> int: """simple docstring""" return 1 if input_a == input_a else 0 def __lowerCamelCase ( ) -> None: """simple docstring""" assert xnor_gate(0 , 0 ) ==...
610
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { """facebook/xglm-564M""": """https://huggingface.co/facebook/xglm-564M/resolve/main/config.json""", # See all XGLM models ...
610
"""simple docstring""" from typing import Optional, Tuple, Union import tensorflow as tf from ...activations_tf import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward from ...modeling_tf_outputs import ( TFBaseModelOutputWithNoAttent...
610
1
"""simple docstring""" import unittest from transformers import RoFormerTokenizer, RoFormerTokenizerFast from transformers.testing_utils import require_rjieba, require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_rjieba @require_tokenizers class __lowerCamelCase ...
610
"""simple docstring""" import math def __lowerCamelCase ( __UpperCamelCase ) -> int: """simple docstring""" if not isinstance(__UpperCamelCase , __UpperCamelCase ): lowerCAmelCase_ : Any = f'''Input value of [number={number}] must be an integer''' ...
610
1
"""simple docstring""" import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging lowercase__ = logging.get_logger(__name__) def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase ) -> Optional[An...
610
"""simple docstring""" import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import Tenso...
610
1
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ) -> bool: """simple docstring""" if graph[path[curr_ind - 1]][next_ver] == 0: return False # 2. Validate that next vertex is not already in pat...
610
"""simple docstring""" import unittest import numpy as np import torch from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad class __lowerCamelCase ( unittest.TestCase ): '''simple docstring''' def lowerCamelCase ( self ...
610
1
"""simple docstring""" import logging import os import sys from dataclasses import dataclass, field from typing import Optional import torch from datasets import load_dataset from torchvision.transforms import Compose, Lambda, Normalize, RandomHorizontalFlip, RandomResizedCrop, ToTensor from torchvision.transf...
610
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_flax_available, is_torch_available, is_transformers_available, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyN...
610
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowercase__ = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable...
610
"""simple docstring""" import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __lowerCamelCase ...
610
1
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class __lowerCamelCase ...
610
"""simple docstring""" # Lint as: python3 import itertools import os import re lowercase__ = re.compile(r"""([A-Z]+)([A-Z][a-z])""") lowercase__ = re.compile(r"""([a-z\d])([A-Z])""") lowercase__ = re.compile(r"""(?<!_)_(?!_)""") lowercase__ = re.compile(r"""(_{2,})""") lowerc...
610
1
"""simple docstring""" import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py lowercase__ = """src/transformers""" # This i...
610
"""simple docstring""" import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class __lowerCamelCase ( A__ , A__ ): '''simple docstring''' @register_to_config def __init__( self : ...
610
1
"""simple docstring""" from dataclasses import dataclass, field from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import pyarrow as pa if TYPE_CHECKING: from .features import FeatureType @dataclass class __lowerCamelCase : '''simple docstring''' a_...
610
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase ) -> str: """simple docstring""" return "".join([hex(__UpperCamelCase )[2:].zfill(2 ).upper() for byte in list(__UpperCamelCase )] ) def __lowerCamelCase ( __UpperCamelCase ) -> byte...
610
1
"""simple docstring""" from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be chec...
610
"""simple docstring""" import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING, B...
610
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowercase__ = { """configuration_mvp""": ["""MVP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MvpConfig""", """MvpOnnxConfig"""], """to...
610
"""simple docstring""" from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowercase__ = {"""UserAgent""": UserAgent().random} def __lowerCamelCase ( __UpperCamelCase ) -> dict: """simple docstrin...
610
1
"""simple docstring""" import json import logging import os import socket import git import numpy as np import torch logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - PID: %(process)d - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""", level=logging.INFO, ) lowercase__ =...
610
"""simple docstring""" import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import Token...
610
1
"""simple docstring""" import os import time import numpy as np import onnxruntime as ort lowercase__ = """1""" lowercase__ = """0""" lowercase__ = """1""" lowercase__ = ort.SessionOptions() lowercase__ = ort.GraphOptimizationLevel.ORT_DISABLE_ALL print("""Create infe...
610
"""simple docstring""" from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be chec...
610
1
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase = 4000000 ) -> int: """simple docstring""" lowerCAmelCase_ : Tuple = [] lowerCAmelCase_ , lowerCAmelCase_ : Union[str, Any] = 0, 1 while b <= n: if b % 2 == 0: ...
610
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ) -> float: """simple docstring""" return round(float(moles / volume ) * nfactor ) def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __Upp...
610
1
"""simple docstring""" import inspect import unittest from math import floor from transformers import CvtConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_con...
610
"""simple docstring""" import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from...
610
1
"""simple docstring""" def __lowerCamelCase ( ) -> int: """simple docstring""" for n in range(1 , 1000000 ): yield n * (n + 1) // 2 def __lowerCamelCase ( __UpperCamelCase ) -> int: """simple docstring""" lowerCAmelCase_ : str ...
610
"""simple docstring""" from typing import Any def __lowerCamelCase ( __UpperCamelCase ) -> list[Any]: """simple docstring""" if not input_list: return [] lowerCAmelCase_ : Any = [input_list.count(__UpperCamelCase ) for value in input_list] lowerCAme...
610
1
"""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 a...
610
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils impo...
610
1
"""simple docstring""" lowercase__ = 8.3144598 def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase ) -> float: """simple docstring""" if temperature < 0: raise Exception("Temperature cannot be less than 0 K" ) if molar_mass <= 0: raise Exception("...
610
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase__ = { """configuration...
610
1
"""simple docstring""" import argparse import json import os import pickle import shutil import numpy as np import torch from distiller import Distiller from lm_seqs_dataset import LmSeqsDataset from transformers import ( BertConfig, BertForMaskedLM, BertTokenizer, DistilBertConfig, Distil...
610
"""simple docstring""" lowercase__ = """ # Transformers 설치 방법 ! pip install transformers datasets # 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요. # ! pip install git+https://github.com/huggingface/transformers.git """ lowercase__ = [{"""type""": """code""", """content""": INSTALL_CONTENT}...
610
1
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase ) -> int: """simple docstring""" lowerCAmelCase_ : List[str] = [0] * len(__UpperCamelCase ) lowerCAmelCase_ : Tuple = [] lowerCAmelCase_ : Optional[int] = []...
610
"""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 ...
610
1
"""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_tensor...
610
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase ) -> tuple[int, int]: """simple docstring""" try: lowerCAmelCase_ : Tuple = float(__UpperCamelCase ) except ValueError: raise ValueError("Please enter a valid number" ) lowerCAmelCa...
610
1
"""simple docstring""" lowercase__ = { "joule": 1.0, "kilojoule": 1000, "megajoule": 1000000, "gigajoule": 1000000000, "wattsecond": 1.0, "watthour": 3600, "kilowatthour": 3600000, "newtonmeter": 1.0, "calorie_nutr": 4186.8, "kilocalorie_nutr": 4186800.00, "el...
610
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase ) -> int: """simple docstring""" return 1 if input_a == input_a else 0 def __lowerCamelCase ( ) -> None: """simple docstring""" assert xnor_gate(0 , 0 ) ==...
610
1
"""simple docstring""" # Lint as: python3 import itertools import os import re lowercase__ = re.compile(r"""([A-Z]+)([A-Z][a-z])""") lowercase__ = re.compile(r"""([a-z\d])([A-Z])""") lowercase__ = re.compile(r"""(?<!_)_(?!_)""") lowercase__ = re.compile(r"""(_{2,})""") lowerc...
610
"""simple docstring""" from typing import Optional, Tuple, Union import tensorflow as tf from ...activations_tf import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward from ...modeling_tf_outputs import ( TFBaseModelOutputWithNoAttent...
610
1
"""simple docstring""" import json import os import pickle import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers import is_faiss_available from transformers.models.bart.configuration_bart import BartConfig ...
610
"""simple docstring""" import math def __lowerCamelCase ( __UpperCamelCase ) -> int: """simple docstring""" if not isinstance(__UpperCamelCase , __UpperCamelCase ): lowerCAmelCase_ : Any = f'''Input value of [number={number}] must be an integer''' ...
610
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, SchedulerOutput def...
610
"""simple docstring""" import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import Tenso...
610
1
"""simple docstring""" import argparse import json import os import torch from transformers.file_utils import has_file from diffusers import UNetaDConditionModel, UNetaDModel lowercase__ = False lowercase__ = True lowercase__ = False if __name__ == "__main__": lowercase__ ...
610
"""simple docstring""" import unittest import numpy as np import torch from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad class __lowerCamelCase ( unittest.TestCase ): '''simple docstring''' def lowerCamelCase ( self ...
610
1
"""simple docstring""" import torch from diffusers import DiffusionPipeline class __lowerCamelCase ( A__ ): '''simple docstring''' def __init__( self : List[str] , a_ : Optional[Any] , a_ : Dict ): super().__init__() self.reg...
610
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_flax_available, is_torch_available, is_transformers_available, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyN...
610
1
"""simple docstring""" from __future__ import annotations import math from collections import Counter from string import ascii_lowercase def __lowerCamelCase ( __UpperCamelCase ) -> None: """simple docstring""" lowerCAmelCase_ , lowerCAmelCase_ : List[str] ...
610
"""simple docstring""" import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __lowerCamelCase ...
610
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) lowercase__ = { """configuration_perceiver""": ["""PERCEIVER_PRETRAINED_CONFIG_ARCHIV...
610
"""simple docstring""" # Lint as: python3 import itertools import os import re lowercase__ = re.compile(r"""([A-Z]+)([A-Z][a-z])""") lowercase__ = re.compile(r"""([a-z\d])([A-Z])""") lowercase__ = re.compile(r"""(?<!_)_(?!_)""") lowercase__ = re.compile(r"""(_{2,})""") lowerc...
610
1
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase ) -> bool: """simple docstring""" lowerCAmelCase_ : Tuple = 0 for ch in input_str: lowerCAmelCase_ : Union[str, Any] = ord(__UpperCamelCase ) lowerCAmelCase_ : List...
610
"""simple docstring""" import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class __lowerCamelCase ( A__ , A__ ): '''simple docstring''' @register_to_config def __init__( self : ...
610
1
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { """huggingface/informer-tourism-monthly""": ( """https://huggingface.co/hugg...
610
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase ) -> str: """simple docstring""" return "".join([hex(__UpperCamelCase )[2:].zfill(2 ).upper() for byte in list(__UpperCamelCase )] ) def __lowerCamelCase ( __UpperCamelCase ) -> byte...
610
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowercase__ = { """configuration_timesformer""": ["""TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TimesformerConfig"""], } try: if not is_torch_av...
610
"""simple docstring""" import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING, B...
610
1
"""simple docstring""" from __future__ import annotations def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ) -> Optional[int]: # noqa: E741 """simple docstring""" while r - l > 1: lowerCAmelCase_ : Any = ...
610
"""simple docstring""" from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowercase__ = {"""UserAgent""": UserAgent().random} def __lowerCamelCase ( __UpperCamelCase ) -> dict: """simple docstrin...
610
1
"""simple docstring""" from typing import Any def __lowerCamelCase ( __UpperCamelCase ) -> list[Any]: """simple docstring""" if not input_list: return [] lowerCAmelCase_ : Any = [input_list.count(__UpperCamelCase ) for value in input_list] lowerCAme...
610
"""simple docstring""" import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import Token...
610
1
"""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...
610
"""simple docstring""" from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be chec...
610
1
"""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, MusicgenForConditionalGenerat...
610
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ) -> float: """simple docstring""" return round(float(moles / volume ) * nfactor ) def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __Upp...
610
1
"""simple docstring""" import pytest import datasets.config from datasets.utils.info_utils import is_small_dataset @pytest.mark.parametrize("dataset_size" , [None, 400 * 2**20, 600 * 2**20] ) @pytest.mark.parametrize("input_in_memory_max_size" , ["default", 0, 100 * 2**20, 900 * 2**20] ) def __l...
610
"""simple docstring""" import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from...
610
1
"""simple docstring""" import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = {"""vocab_file""": """vocab....
610
"""simple docstring""" from typing import Any def __lowerCamelCase ( __UpperCamelCase ) -> list[Any]: """simple docstring""" if not input_list: return [] lowerCAmelCase_ : Any = [input_list.count(__UpperCamelCase ) for value in input_list] lowerCAme...
610
1
"""simple docstring""" from __future__ import annotations from collections.abc import Generator def __lowerCamelCase ( ) -> Generator[int, None, None]: """simple docstring""" lowerCAmelCase_ : dict[int, int] = {} lowerCAmelCase_ : int = 2 ...
610
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils impo...
610
1
"""simple docstring""" import unittest from transformers.testing_utils import CaptureStdout from transformers.tools.python_interpreter import evaluate def __lowerCamelCase ( __UpperCamelCase ) -> str: """simple docstring""" return x + 2 class __lowerCamelCase ...
610
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase__ = { """configuration...
610
1
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase ) -> list: """simple docstring""" return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(__UpperCamelCase ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__(...
610
"""simple docstring""" lowercase__ = """ # Transformers 설치 방법 ! pip install transformers datasets # 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요. # ! pip install git+https://github.com/huggingface/transformers.git """ lowercase__ = [{"""type""": """code""", """content""": INSTALL_CONTENT}...
610
1
"""simple docstring""" import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets lowercase__ = """\ @inproceedings{kakwani2020indicnlpsuite, title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchmarks and Pre-trained Multilingual La...
610
"""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 ...
610
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowercase__ = { """configuration_lilt""": ["""LILT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LiltConfig"""], } try: if not is_torch_available(): ...
610
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase ) -> tuple[int, int]: """simple docstring""" try: lowerCAmelCase_ : Tuple = float(__UpperCamelCase ) except ValueError: raise ValueError("Please enter a valid number" ) lowerCAmelCa...
610
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig lowercase__ = { """google/tapas-base-finetuned-sqa""": ( """https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json""" ), """google/tapas-base-finetuned-wtq""": ( """https://h...
610
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase ) -> int: """simple docstring""" return 1 if input_a == input_a else 0 def __lowerCamelCase ( ) -> None: """simple docstring""" assert xnor_gate(0 , 0 ) ==...
610
1
"""simple docstring""" import re def __lowerCamelCase ( __UpperCamelCase ) -> bool: """simple docstring""" lowerCAmelCase_ : str = re.compile( r"^(?:0|94|\+94|0{2}94)" r"7(0|1|2|4|5|6|7|8)" r"(-| |)" r"\d{7}$" ) return bool(re.search(__UpperCamelCa...
610
"""simple docstring""" from typing import Optional, Tuple, Union import tensorflow as tf from ...activations_tf import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward from ...modeling_tf_outputs import ( TFBaseModelOutputWithNoAttent...
610
1
"""simple docstring""" from sklearn.metrics import recall_score import datasets lowercase__ = """ Recall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation: Recall = TP / (TP + FN) Where TP is the true positives and FN i...
610
"""simple docstring""" import math def __lowerCamelCase ( __UpperCamelCase ) -> int: """simple docstring""" if not isinstance(__UpperCamelCase , __UpperCamelCase ): lowerCAmelCase_ : Any = f'''Input value of [number={number}] must be an integer''' ...
610
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor lowercase__ = logging.get_logger(__name__) class __lowerCamelCase ( A__ ): '''simple docstring''' def __init__( self : List[s...
610
"""simple docstring""" import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import Tenso...
610
1
"""simple docstring""" 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...
610
"""simple docstring""" import unittest import numpy as np import torch from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad class __lowerCamelCase ( unittest.TestCase ): '''simple docstring''' def lowerCamelCase ( self ...
610
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowercase__ = {"""configuration_ibert""": ["""IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """IBertConfig""", """IBertOnnxConfig"""]} try: if not is_torch_avai...
610
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_flax_available, is_torch_available, is_transformers_available, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyN...
610
1
"""simple docstring""" import torch from transformers import CamembertForMaskedLM, CamembertTokenizer def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , __UpperCamelCase=5 ) -> List[Any]: """simple docstring""" assert masked_input.count("<m...
610
"""simple docstring""" import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __lowerCamelCase ...
610
1
"""simple docstring""" print((lambda quine: quine % quine)("""print((lambda quine: quine %% quine)(%r))"""))
610
"""simple docstring""" # Lint as: python3 import itertools import os import re lowercase__ = re.compile(r"""([A-Z]+)([A-Z][a-z])""") lowercase__ = re.compile(r"""([a-z\d])([A-Z])""") lowercase__ = re.compile(r"""(?<!_)_(?!_)""") lowercase__ = re.compile(r"""(_{2,})""") lowerc...
610
1
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase ) -> Optional[Any]: """simple docstring""" lowerCAmelCase_ : Any = [1] for i in range(2 , __UpperCamelCase ): factorials.append(factorials[-1] * i ) assert 0 <= k...
610
"""simple docstring""" import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class __lowerCamelCase ( A__ , A__ ): '''simple docstring''' @register_to_config def __init__( self : ...
610
1
"""simple docstring""" import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase ) -> int: """simp...
610
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase ) -> str: """simple docstring""" return "".join([hex(__UpperCamelCase )[2:].zfill(2 ).upper() for byte in list(__UpperCamelCase )] ) def __lowerCamelCase ( __UpperCamelCase ) -> byte...
610
1
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_...
610
"""simple docstring""" import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING, B...
610
1
"""simple docstring""" import inspect from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch import torch.utils.checkpoint from ...models import UNetaDModel, VQModel from ...schedulers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteSc...
610
"""simple docstring""" from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowercase__ = {"""UserAgent""": UserAgent().random} def __lowerCamelCase ( __UpperCamelCase ) -> dict: """simple docstrin...
610
1
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase = False ) -> str: """simple docstring""" if not isinstance(__UpperCamelCase , __UpperCamelCase ): lowerCAmelCase_ : List[str] = f'''Expected string as input, found {typ...
610
"""simple docstring""" import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import Token...
610
1
"""simple docstring""" import unittest 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 ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_...
610
"""simple docstring""" from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be chec...
610
1
"""simple docstring""" import tempfile import unittest import numpy as np import transformers from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow from ...generation.test_flax_utils import...
610
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ) -> float: """simple docstring""" return round(float(moles / volume ) * nfactor ) def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __Upp...
610
1
"""simple docstring""" # Algorithm for the pigeonhole sorting def __lowerCamelCase ( __UpperCamelCase ) -> List[str]: """simple docstring""" lowerCAmelCase_ : int = min(__UpperCamelCase ) # min() finds the minimum value lowerCAmelCase_ : int ...
610
"""simple docstring""" import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from...
610
1
"""simple docstring""" from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split lowercase__ = datasets.load_iris() lowercase__ = np.array(data["""data"""]) lowercase__ = np.array(data["""target"""]) lowercase_...
610
"""simple docstring""" from typing import Any def __lowerCamelCase ( __UpperCamelCase ) -> list[Any]: """simple docstring""" if not input_list: return [] lowerCAmelCase_ : Any = [input_list.count(__UpperCamelCase ) for value in input_list] lowerCAme...
610
1
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase ) -> tuple[float, float]: """simple docstring""" if not len(__UpperCamelCase ) == len(__UpperCamelCase ) == 3: raise ValueError("Please enter a valid equation." ) if equationa[0] ==...
610
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils impo...
610
1
"""simple docstring""" import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers...
610
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase__ = { """configuration...
610
1
"""simple docstring""" import argparse import intel_extension_for_pytorch as ipex import torch from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline lowercase__ = argparse.ArgumentParser("""Stable Diffusion script with intel optimization""", add_help=False) parser.add_argument("...
610
"""simple docstring""" lowercase__ = """ # Transformers 설치 방법 ! pip install transformers datasets # 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요. # ! pip install git+https://github.com/huggingface/transformers.git """ lowercase__ = [{"""type""": """code""", """content""": INSTALL_CONTENT}...
610
1
"""simple docstring""" from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer lowercase__ = logging.get_logger(__nam...
610
"""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 ...
610
1
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase ) -> bool: """simple docstring""" return str(__UpperCamelCase ) == str(__UpperCamelCase )[::-1] def __lowerCamelCase ( __UpperCamelCase ) -> int: """simple docstring""" retur...
610
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase ) -> tuple[int, int]: """simple docstring""" try: lowerCAmelCase_ : Tuple = float(__UpperCamelCase ) except ValueError: raise ValueError("Please enter a valid number" ) lowerCAmelCa...
610
1
"""simple docstring""" import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def __lowerCamelCase ( __UpperCamelCase ...
610
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase ) -> int: """simple docstring""" return 1 if input_a == input_a else 0 def __lowerCamelCase ( ) -> None: """simple docstring""" assert xnor_gate(0 , 0 ) ==...
610
1