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
def _a ( SCREAMING_SNAKE_CASE = 10 ): """simple docstring""" if not isinstance(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) or n < 0: raise ValueError('''Invalid input''' ) lowercase__ = 10**n lowercase__ = 2_84_33 * (pow(2 , 7_83_04_57 , SCREAMING...
43
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device f...
43
1
from __future__ import annotations from dataclasses import dataclass @dataclass class _a : _lowercase : float _lowercase : TreeNode | None = None _lowercase : TreeNode | None = None def _a ( SCREAMING_SNAKE_CASE ): ...
43
from ...utils import logging from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel from .configuration_mta import MTaConfig lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = 'T5Config' class _a ( UpperCamelCase__ ): _l...
43
1
import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IM...
43
from datetime import datetime import matplotlib.pyplot as plt import torch def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" for param in module.parameters(): lowercase__ = False def _a ( ): """simple docstring""" lowercase__ = '''cuda''...
43
1
lowerCAmelCase = '\n# Transformers 설치 방법\n! pip install transformers datasets\n# 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요.\n# ! pip install git+https://github.com/huggingface/transformers.git\n' lowerCAmelCase = [{'type': 'code', 'content': INSTALL_CONTENT}] lowerCAmelCase = { '{...
43
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, is_vis...
43
1
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...
43
def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" return "".join([hex(SCREAMING_SNAKE_CASE )[2:].zfill(2 ).upper() for byte in list(SCREAMING_SNAKE_CASE )] ) def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" if (len(SCREAMING_SNAKE_CASE ) % 2) != ...
43
1
import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( ...
43
from __future__ import annotations def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ , lowercase__ = position lowercase__ = [ (y + 1, x + 2), (y - 1, x + 2), (y + 1, x - 2), (y - 1, x - 2), ...
43
1
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _a ( UpperCamelCase__ ): _lowercase : str = ['''image_processor''', '''tokenizer'''] _lowercase : Any = '''CLIPImagePro...
43
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...schedulers import HeunDiscreteSch...
43
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = { 'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json', # See all ViT MSN models at https://hug...
43
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo lowerCAmelCase = '\\n@misc{wu2016googles,\n title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yonghui ...
43
1
from ..utils import DummyObject, requires_backends class _a ( metaclass=UpperCamelCase__ ): _lowercase : Dict = ['''flax''', '''transformers'''] def __init__( self: Optional[int] , *UpperCamelCase_: Any , **UpperCamelCase_: List...
43
import unittest from diffusers.models.unet_ad_blocks import * # noqa F403 from diffusers.utils import torch_device from .test_unet_blocks_common import UNetBlockTesterMixin class _a ( UpperCamelCase__ , unittest.TestCase ): _lowercase : Optional[Any] = Down...
43
1
from tempfile import TemporaryDirectory from unittest import TestCase from unittest.mock import MagicMock, patch from transformers import AutoModel, TFAutoModel from transformers.onnx import FeaturesManager from transformers.testing_utils import SMALL_MODEL_IDENTIFIER, require_tf, require_torch @requi...
43
def _a ( SCREAMING_SNAKE_CASE = "The quick brown fox jumps over the lazy dog" , ): """simple docstring""" lowercase__ = set() # Replace all the whitespace in our sentence lowercase__ = input_str.replace(''' ''' , '''''' ) for alpha in input_str: if "a...
43
1
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
43
import unicodedata from dataclasses import dataclass from typing import Optional, Union import numpy as np from transformers.data.data_collator import DataCollatorMixin from transformers.file_utils import PaddingStrategy from transformers.tokenization_utils_base import PreTrainedTokenizerBase def ...
43
1
import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...
43
import math import time from typing import Dict, List, Optional from torch.utils.data import Dataset from transformers import SeqaSeqTrainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_...
43
1
from math import pi, sqrt, tan def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" if side_length < 0: raise ValueError('''surface_area_cube() only accepts non-negative values''' ) return 6 * side_length**2 def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CA...
43
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = os.path.join(args.tf_model_dir , '''parameters.json''' ) lowercas...
43
1
from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop...
43
from __future__ import annotations def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" return len(set(SCREAMING_SNAKE_CASE ) ) == len(SCREAMING_SNAKE_CASE ) if __name__ == "__main__": import doctest doctest.testmod()
43
1
def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" _enforce_args(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) if n == 0: return 0 lowercase__ = float('''-inf''' ) for i in range(1 , n + 1 ): lowercase__ = max( ...
43
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase = { 'configuration_convbert': ['CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ConvBertConfig',...
43
1
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
import gc import unittest from diffusers import FlaxStableDiffusionInpaintPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import rep...
43
1
from __future__ import annotations import math def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" if depth < 0: raise ValueError('''Depth cannot be less ...
43
from __future__ import annotations import math def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" if depth < 0: raise ValueError('''Depth cannot be less ...
43
1
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from transforme...
43
class _a : def __init__( self: Tuple , UpperCamelCase_: Dict ) -> List[str]: """simple docstring""" lowercase__ = val lowercase__ = None lowercase__ = None def lowerCamelCase_ ( ...
43
1
def _a ( SCREAMING_SNAKE_CASE = "The quick brown fox jumps over the lazy dog" , ): """simple docstring""" lowercase__ = set() # Replace all the whitespace in our sentence lowercase__ = input_str.replace(''' ''' , '''''' ) for alpha in input_str: if "a...
43
lowerCAmelCase = { 'a': 'AAAAA', 'b': 'AAAAB', 'c': 'AAABA', 'd': 'AAABB', 'e': 'AABAA', 'f': 'AABAB', 'g': 'AABBA', 'h': 'AABBB', 'i': 'ABAAA', 'j': 'BBBAA', 'k': 'ABAAB', 'l': 'ABABA', 'm': 'ABABB', 'n': 'ABBAA', 'o': 'ABBAB', ...
43
1
import os import unittest from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, BertTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_ut...
43
import numpy as np def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" return 1 / (1 + np.exp(-vector )) if __name__ == "__main__": import doctest doctest.testmod()
43
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = '▁' lowe...
43
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = '▁' lowe...
43
1
# 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 # # Unless require...
43
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from transforme...
43
1
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class _a : _lowercase : int _lowercase : Node | None = None _lowercase ...
43
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device f...
43
1
import math def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = [] lowercase__ = 2 lowercase__ = int(math.sqrt(SCREAMING_SNAKE_CASE ) ) # Size of every segment lowercase__ = [True] * (end + 1) lowercase__ = [] while start <= end: ...
43
from ...utils import logging from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel from .configuration_mta import MTaConfig lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = 'T5Config' class _a ( UpperCamelCase__ ): _l...
43
1
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, ClassLabel, Features from .base import TaskTemplate @dataclass(frozen=UpperCamelCase__ ) class _a ( UpperCamelCase__ ): _lowercase : str = fie...
43
from datetime import datetime import matplotlib.pyplot as plt import torch def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" for param in module.parameters(): lowercase__ = False def _a ( ): """simple docstring""" lowercase__ = '''cuda''...
43
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = { 'microsoft/swinv2-tiny-patch4-window8-256': ( 'https://huggingface.co/microsoft/swinv2-tiny-patch4-window8-256/resolve/main/config.json...
43
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, is_vis...
43
1
import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class _a ( UpperCamelCase__ , unittest.TestCase ...
43
def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" return "".join([hex(SCREAMING_SNAKE_CASE )[2:].zfill(2 ).upper() for byte in list(SCREAMING_SNAKE_CASE )] ) def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" if (len(SCREAMING_SNAKE_CASE ) % 2) != ...
43
1
from heapq import heappop, heappush import numpy as np def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , ): """simple docstring""" lowercase__ , lowercase__ = grid.shape lowercase__ = [-1, 1...
43
from __future__ import annotations def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ , lowercase__ = position lowercase__ = [ (y + 1, x + 2), (y - 1, x + 2), (y + 1, x - 2), (y - 1, x - 2), ...
43
1
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor lowerCAmelCase = logging.get_logger(__name__) class _a ( UpperCamelCase__ ): def __init__( self: Dict , *UpperCamelCase_: Any , **UpperCamelCase_...
43
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...schedulers import HeunDiscreteSch...
43
1
from __future__ import annotations from collections import namedtuple def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = namedtuple('''result''' , '''name value''' ) if (voltage, current, pow...
43
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo lowerCAmelCase = '\\n@misc{wu2016googles,\n title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yonghui ...
43
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_tf_available, is_torch_available, ) lowerCAmelCase = { 'configuration_speech_to_text': ['SPEECH_TO_TEXT_PRETRAIN...
43
import unittest from diffusers.models.unet_ad_blocks import * # noqa F403 from diffusers.utils import torch_device from .test_unet_blocks_common import UNetBlockTesterMixin class _a ( UpperCamelCase__ , unittest.TestCase ): _lowercase : Optional[Any] = Down...
43
1
import unittest import numpy as np import torch from diffusers import ScoreSdeVePipeline, ScoreSdeVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class _a ( unittest.TestCase ): ...
43
def _a ( SCREAMING_SNAKE_CASE = "The quick brown fox jumps over the lazy dog" , ): """simple docstring""" lowercase__ = set() # Replace all the whitespace in our sentence lowercase__ = input_str.replace(''' ''' , '''''' ) for alpha in input_str: if "a...
43
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowerCAmelCase = {'configuration_deit': ['DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'DeiTConfig', 'DeiTOnnxConfig']} ...
43
import unicodedata from dataclasses import dataclass from typing import Optional, Union import numpy as np from transformers.data.data_collator import DataCollatorMixin from transformers.file_utils import PaddingStrategy from transformers.tokenization_utils_base import PreTrainedTokenizerBase def ...
43
1
import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigT...
43
import math import time from typing import Dict, List, Optional from torch.utils.data import Dataset from transformers import SeqaSeqTrainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_...
43
1
def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" return x if y == 0 else greatest_common_divisor(SCREAMING_SNAKE_CASE , x % y ) def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" r...
43
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = os.path.join(args.tf_model_dir , '''parameters.json''' ) lowercas...
43
1
import json import os import unittest from transformers import BatchEncoding, MvpTokenizer, MvpTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils import cached_propert...
43
from __future__ import annotations def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" return len(set(SCREAMING_SNAKE_CASE ) ) == len(SCREAMING_SNAKE_CASE ) if __name__ == "__main__": import doctest doctest.testmod()
43
1
from __future__ import annotations import math lowerCAmelCase = '2020.9.26' lowerCAmelCase = 'xcodz-dot, cclaus, dhruvmanila' def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): "...
43
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase = { 'configuration_convbert': ['CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ConvBertConfig',...
43
1
from ...utils import logging from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel from .configuration_mta import MTaConfig lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = 'T5Config' class _a ( UpperCamelCase__ ): _l...
43
import gc import unittest from diffusers import FlaxStableDiffusionInpaintPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import rep...
43
1
def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ , lowercase__ = [], [] while len(SCREAMING_SNAKE_CASE ) > 1: lowercase__ , lowercase__ = min(SCREAMING_SNAKE_CASE ), max(SCREAMING_SNAKE_CASE ) start.append(SCREAMING_SNAKE_CASE ) end.a...
43
from __future__ import annotations import math def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" if depth < 0: raise ValueError('''Depth cannot be less ...
43
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase = {'configuration_ibert': ['IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'IBertConfig', 'IBertOnnxConfig']} try: if not is_torch_available(): raise OptionalDepen...
43
class _a : def __init__( self: Tuple , UpperCamelCase_: Dict ) -> List[str]: """simple docstring""" lowercase__ = val lowercase__ = None lowercase__ = None def lowerCamelCase_ ( ...
43
1
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE__ : Optional[int] = { """configuration_mctct""": ["""MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MCTCTConfig"""], """feature_extraction_mctct""": ["""MC...
0
lowerCAmelCase = { 'a': 'AAAAA', 'b': 'AAAAB', 'c': 'AAABA', 'd': 'AAABB', 'e': 'AABAA', 'f': 'AABAB', 'g': 'AABBA', 'h': 'AABBB', 'i': 'ABAAA', 'j': 'BBBAA', 'k': 'ABAAB', 'l': 'ABABA', 'm': 'ABABB', 'n': 'ABBAA', 'o': 'ABBAB', ...
43
0
import argparse import gc import json import os import re import torch from huggingface_hub import hf_hub_download from transformers import AutoModelForCausalLM, AutoTokenizer, PreTrainedTokenizerFast, RwkvConfig from transformers.modeling_utils import WEIGHTS_INDEX_NAME, shard_checkpoint __snake...
1
import numpy as np def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" return 1 / (1 + np.exp(-vector )) if __name__ == "__main__": import doctest doctest.testmod()
43
0
import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class lowerCamelCase__ ( _A , unittest.TestCase...
2
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = '▁' lowe...
43
0
'''simple docstring''' from manim import * class SCREAMING_SNAKE_CASE__ ( snake_case_): def UpperCAmelCase_ ( self )-> str: '''simple docstring''' UpperCamelCase = Rectangle(height=0.5 , width=0...
3
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from transforme...
43
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __UpperCamelCase : Optional[Any] = { '''configuration_falcon''': ['''FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''FalconConfig''...
4
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device f...
43
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase = logging.get_logger(__name__) _lowercase = { """facebook/dpr-ctx_encoder-single-nq-base""": ( """https://huggingface.co/facebook/dpr-ctx_encoder-single-nq-ba...
5
from ...utils import logging from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel from .configuration_mta import MTaConfig lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = 'T5Config' class _a ( UpperCamelCase__ ): _l...
43
0
from __future__ import annotations def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: list[float] , UpperCamelCase__: list[float] ): SCREAMING_SNAKE_CASE__ = sorted(numsa + numsa ) SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ = divmod(len(UpperC...
6
from datetime import datetime import matplotlib.pyplot as plt import torch def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" for param in module.parameters(): lowercase__ = False def _a ( ): """simple docstring""" lowercase__ = '''cuda''...
43
0
"""simple docstring""" from datetime import datetime import matplotlib.pyplot as plt import torch def _snake_case ( _snake_case : Dict ) -> Optional[Any]: '''simple docstring''' for param in module.parameters(): _A = False def _snake_case ( ...
7
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, is_vis...
43
0
'''simple docstring''' import argparse import torch from huggingface_hub import hf_hub_download from transformers import AutoTokenizer, RobertaPreLayerNormConfig, RobertaPreLayerNormForMaskedLM from transformers.utils import logging logging.set_verbosity_info() lowercase__ : Tup...
8
def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" return "".join([hex(SCREAMING_SNAKE_CASE )[2:].zfill(2 ).upper() for byte in list(SCREAMING_SNAKE_CASE )] ) def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" if (len(SCREAMING_SNAKE_CASE ) % 2) != ...
43
0
from __future__ import annotations import string from itertools import cycle, product from pathlib import Path SCREAMING_SNAKE_CASE__ = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) SCREAMING_SNAKE_CASE__ = [ord(letter) for letter in string.ascii_lowercase] SC...
9
from __future__ import annotations def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ , lowercase__ = position lowercase__ = [ (y + 1, x + 2), (y - 1, x + 2), (y + 1, x - 2), (y - 1, x - 2), ...
43
0
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor from .....
10
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...schedulers import HeunDiscreteSch...
43
0
'''simple docstring''' def lowerCAmelCase (__A): """simple docstring""" if not all(x.isalpha() for x in string): raise ValueError('''String must only contain alphabetic characters.''') _a = sorted(string.lower()) return len(__A) == len(set(__A)) if __name_...
11
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo lowerCAmelCase = '\\n@misc{wu2016googles,\n title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yonghui ...
43
0
def UpperCamelCase ( lowercase_ ) -> str: '''simple docstring''' if not all(char in """01""" for char in bin_string ): raise ValueError("""Non-binary value was passed to the function""" ) if not bin_string: raise ValueError("""Empty string was passed to the function""...
12
import unittest from diffusers.models.unet_ad_blocks import * # noqa F403 from diffusers.utils import torch_device from .test_unet_blocks_common import UNetBlockTesterMixin class _a ( UpperCamelCase__ , unittest.TestCase ): _lowercase : Optional[Any] = Down...
43
0
'''simple docstring''' from __future__ import annotations import typing from collections.abc import Iterable import numpy as np A__ : Dict = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 A__ : Optional[Any] = typing.Union[np.floataa, int, float] # noqa: UP00...
13
def _a ( SCREAMING_SNAKE_CASE = "The quick brown fox jumps over the lazy dog" , ): """simple docstring""" lowercase__ = set() # Replace all the whitespace in our sentence lowercase__ = input_str.replace(''' ''' , '''''' ) for alpha in input_str: if "a...
43
0
from __future__ import annotations import math def __UpperCAmelCase ( __a : int ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Nega...
14
import unicodedata from dataclasses import dataclass from typing import Optional, Union import numpy as np from transformers.data.data_collator import DataCollatorMixin from transformers.file_utils import PaddingStrategy from transformers.tokenization_utils_base import PreTrainedTokenizerBase def ...
43
0
import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNetaDConditionModel, ) fro...
15
import math import time from typing import Dict, List, Optional from torch.utils.data import Dataset from transformers import SeqaSeqTrainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_...
43
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices ...
16
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = os.path.join(args.tf_model_dir , '''parameters.json''' ) lowercas...
43
0
import sys def __SCREAMING_SNAKE_CASE ( a__ : List[Any] ) -> int: __A : Union[str, Any] = len(a__ ) __A : Any = [[0 for x in range(a__ )] for x in range(a__ )] __A : Optional[Any] = [[0 for x in range(a__ )] for x in range(a__ ...
17
from __future__ import annotations def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" return len(set(SCREAMING_SNAKE_CASE ) ) == len(SCREAMING_SNAKE_CASE ) if __name__ == "__main__": import doctest doctest.testmod()
43
0
'''simple docstring''' from __future__ import annotations def __a(SCREAMING_SNAKE_CASE_ : int | float | str , SCREAMING_SNAKE_CASE_ : int | float | str ): '''simple docstring''' if nth_term == "": return [""] _lowerCAmelCase = int(SCREAMING...
18
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase = { 'configuration_convbert': ['CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ConvBertConfig',...
43
0
"""simple docstring""" import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ConvNextConfig, UperNetConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import ...
19
import gc import unittest from diffusers import FlaxStableDiffusionInpaintPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import rep...
43
0
from __future__ import annotations import math def _lowercase( __a : int ): if num <= 0: a__ =f"""{num}: Invalid input, please enter a positive integer.""" raise ValueError(__a ) a__ =[True] * (num + 1) a__ =[] a__ ...
20
from __future__ import annotations import math def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" if depth < 0: raise ValueError('''Depth cannot be less ...
43
0
def lowerCAmelCase_ ( lowerCamelCase ): if not numbers: return 0 if not isinstance(lowerCamelCase , (list, tuple) ) or not all( isinstance(lowerCamelCase , lowerCamelCase ) for number in numbers ): raise ValueError("""numbers must be an iterable of int...
21
class _a : def __init__( self: Tuple , UpperCamelCase_: Dict ) -> List[str]: """simple docstring""" lowercase__ = val lowercase__ = None lowercase__ = None def lowerCamelCase_ ( ...
43
0
'''simple docstring''' from __future__ import annotations _snake_case : List[str] = [ [-1, 0], # left [0, -1], # down [1, 0], # right [0, 1], # up ] def snake_case_ (UpperCamelCase : list[list[int]] , UpperCamelCase : list[int] , Uppe...
22
lowerCAmelCase = { 'a': 'AAAAA', 'b': 'AAAAB', 'c': 'AAABA', 'd': 'AAABB', 'e': 'AABAA', 'f': 'AABAB', 'g': 'AABBA', 'h': 'AABBB', 'i': 'ABAAA', 'j': 'BBBAA', 'k': 'ABAAB', 'l': 'ABABA', 'm': 'ABABB', 'n': 'ABBAA', 'o': 'ABBAB', ...
43
0
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case__ : Dict = logging.get_logger(__name__) snake_case__ : Optional[Any] = { """uw-madison/mra-base-512-4""": """https://huggingface.co/uw-madison/mra-base-512-4/...
23
import numpy as np def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" return 1 / (1 + np.exp(-vector )) if __name__ == "__main__": import doctest doctest.testmod()
43
0
'''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 .util...
24
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = '▁' lowe...
43
0
from dataclasses import dataclass from typing import Dict, Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .attention_processor import AttentionProcessor, AttnProcessor from .modeling_...
25
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from transforme...
43
0
'''simple docstring''' from sklearn.metrics import recall_score import datasets __UpperCamelCase = "\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere TP is...
26
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device f...
43
0
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" print('\nThe shortest path matrix using Floyd Warshall algorithm\n' ) for i in range(_SCREAMING_SNAKE_CASE ): for j in range(_SCREAM...
27
from ...utils import logging from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel from .configuration_mta import MTaConfig lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = 'T5Config' class _a ( UpperCamelCase__ ): _l...
43
0
'''simple docstring''' import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() UpperCamelCase_ = logging.get_logger("transformers.models.speecht5") def lowercase__( __UpperCame...
28
from datetime import datetime import matplotlib.pyplot as plt import torch def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" for param in module.parameters(): lowercase__ = False def _a ( ): """simple docstring""" lowercase__ = '''cuda''...
43
0
"""simple docstring""" import json import os import shutil import tempfile import unittest from transformers import BatchEncoding, CanineTokenizer from transformers.testing_utils import require_tokenizers, require_torch from transformers.tokenization_utils import AddedToken from transformers.utils import cached_pro...
29
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, is_vis...
43
0
import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets __a = datasets.logging.get_logger(__name__) __a = '\\n@inproceedings{bleurt,\n title={BLEURT: Learning Robust Metrics for Text Generation},\n author={Thibault Sellam a...
30
def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" return "".join([hex(SCREAMING_SNAKE_CASE )[2:].zfill(2 ).upper() for byte in list(SCREAMING_SNAKE_CASE )] ) def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" if (len(SCREAMING_SNAKE_CASE ) % 2) != ...
43
0
from pickle import UnpicklingError import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict from ..utils import logging lowerCamelCase__ : List[str] = logging.get_logger(__name__) def UpperCAmelCase_ (...
31
from __future__ import annotations def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ , lowercase__ = position lowercase__ = [ (y + 1, x + 2), (y - 1, x + 2), (y + 1, x - 2), (y - 1, x - 2), ...
43
0
import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code from ...ima...
32
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...schedulers import HeunDiscreteSch...
43
0
import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def SCREAMING_SNAKE_CASE ( __lowerCAmelCase ) -> Any: snake_case__ = [ '''encoder.version''', '''decoder.version''', '''model.encode...
33
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo lowerCAmelCase = '\\n@misc{wu2016googles,\n title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yonghui ...
43
0
"""simple docstring""" from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) # TODO Update this SCREAMING_SNAKE_CASE_ = { 'faceb...
34
import unittest from diffusers.models.unet_ad_blocks import * # noqa F403 from diffusers.utils import torch_device from .test_unet_blocks_common import UNetBlockTesterMixin class _a ( UpperCamelCase__ , unittest.TestCase ): _lowercase : Optional[Any] = Down...
43
0
import unittest import numpy as np from datasets import load_dataset 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_...
35
def _a ( SCREAMING_SNAKE_CASE = "The quick brown fox jumps over the lazy dog" , ): """simple docstring""" lowercase__ = set() # Replace all the whitespace in our sentence lowercase__ = input_str.replace(''' ''' , '''''' ) for alpha in input_str: if "a...
43
0
import baseaa def lowercase ( __A : str ) -> bytes: '''simple docstring''' return baseaa.baaencode(string.encode("""utf-8""" ) ) def lowercase ( __A : bytes ) -> str: '''simple docstring''' return baseaa.baadecode(__A ).decode(...
36
import unicodedata from dataclasses import dataclass from typing import Optional, Union import numpy as np from transformers.data.data_collator import DataCollatorMixin from transformers.file_utils import PaddingStrategy from transformers.tokenization_utils_base import PreTrainedTokenizerBase def ...
43
0
from collections import defaultdict from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst def UpperCamelCase_ ( ) -> Optional[Any]: a__, a__ : Tuple = 9, 14 # noqa: F841 a__ : int = [ [0, 1, 4], [0, 7, 8], [1, 2, 8], [7, ...
37
import math import time from typing import Dict, List, Optional from torch.utils.data import Dataset from transformers import SeqaSeqTrainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_...
43
0
'''simple docstring''' from math import pow def UpperCamelCase__ ( __magic_name__ : int , __magic_name__ : int , __magic_name__ : int , __magic_name__ : int , __magic_name__ : int , ) -> tuple[int, int]: '''simple docstring''' if...
38
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = os.path.join(args.tf_model_dir , '''parameters.json''' ) lowercas...
43
0
import cva import numpy as np class snake_case_ : '''simple docstring''' def __init__( self : int , _UpperCamelCase : float , _UpperCamelCase : int ) ->int: if k in (0.04, 0.06): snake_case_ = k ...
39
from __future__ import annotations def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" return len(set(SCREAMING_SNAKE_CASE ) ) == len(SCREAMING_SNAKE_CASE ) if __name__ == "__main__": import doctest doctest.testmod()
43
0
import json import logging import os import re import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import datasets import numpy as np import torch import torchaudio from packaging import version from torch import nn import transformers from transformers import (...
40
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase = { 'configuration_convbert': ['CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ConvBertConfig',...
43
0
'''simple docstring''' import sacrebleu as scb from packaging import version from sacrebleu import CHRF import datasets lowerCAmelCase__ = '''\ @inproceedings{popovic-2015-chrf, title = "chr{F}: character n-gram {F}-score for automatic {MT} evaluation", author = "Popovi{\'c}, Maja", book...
41
import gc import unittest from diffusers import FlaxStableDiffusionInpaintPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import rep...
43
0
'''simple docstring''' from math import pow, sqrt def _UpperCamelCase ( *__UpperCamelCase ) -> bool: lowerCamelCase_ = len(__UpperCamelCase ) > 0 and all(value > 0.0 for value in values ) return result def _UpperCamelCase ( __UpperCamelCase ,__UpperCamelCase ) ...
42
from __future__ import annotations import math def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" if depth < 0: raise ValueError('''Depth cannot be less ...
43
0
'''simple docstring''' import argparse import json import os import torch from transformers.file_utils import has_file from diffusers import UNetaDConditionModel, UNetaDModel UpperCAmelCase_ : Optional[Any] = False UpperCAmelCase_ : str = True UpperCAmelCase_ : Dict = Fals...
44
class _a : def __init__( self: Tuple , UpperCamelCase_: Dict ) -> List[str]: """simple docstring""" lowercase__ = val lowercase__ = None lowercase__ = None def lowerCamelCase_ ( ...
43
0
from math import isqrt def A ( lowercase__ : int ) -> bool: return all(number % divisor != 0 for divisor in range(2 , isqrt(lowercase__ ) + 1 ) ) def A ( lowercase__ : int = 10**6 ) -> int: UpperCamelCase__ :Tuple = 0 UpperCamelCase__ :List[Any] = 1 U...
45
lowerCAmelCase = { 'a': 'AAAAA', 'b': 'AAAAB', 'c': 'AAABA', 'd': 'AAABB', 'e': 'AABAA', 'f': 'AABAB', 'g': 'AABBA', 'h': 'AABBB', 'i': 'ABAAA', 'j': 'BBBAA', 'k': 'ABAAB', 'l': 'ABABA', 'm': 'ABABB', 'n': 'ABBAA', 'o': 'ABBAB', ...
43
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase : List[str] = logging.get_logger(__name__) _lowerCAmelCase : Any = { '''s-JoL/Open-Llama-V1''': '''https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/...
46
import numpy as np def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" return 1 / (1 + np.exp(-vector )) if __name__ == "__main__": import doctest doctest.testmod()
43
0
import os import numpy import onnx def UpperCAmelCase__ ( lowerCamelCase_ : List[str] , lowerCamelCase_ : List[Any] ): __a : Union[str, Any] = a.name __a : Dict = b.name __a : Dict = '' ...
47
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = '▁' lowe...
43
0
'''simple docstring''' import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common import TokenizerTes...
48
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from transforme...
43
0
"""simple docstring""" import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class _UpperCAmelCase ( _lowerCAmelCase ): a__ : str = "" a__ : str = ( None # p...
49
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device f...
43
0
'''simple docstring''' import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def A__ ( __lowerCAmelCase : Any , __lowerCAmelCase : int=None ): lowerCamelCase__ = None ...
50
from ...utils import logging from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel from .configuration_mta import MTaConfig lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = 'T5Config' class _a ( UpperCamelCase__ ): _l...
43
0
'''simple docstring''' import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class lowerCAmelCase__ ( unittest.TestCase ): '''simple docstring''' def __snake_case ( self : int ...
51
from datetime import datetime import matplotlib.pyplot as plt import torch def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" for param in module.parameters(): lowercase__ = False def _a ( ): """simple docstring""" lowercase__ = '''cuda''...
43
0
"""simple docstring""" import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def __A ( a_ :str) -> int: # p...
52
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, is_vis...
43
0
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
53
def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" return "".join([hex(SCREAMING_SNAKE_CASE )[2:].zfill(2 ).upper() for byte in list(SCREAMING_SNAKE_CASE )] ) def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" if (len(SCREAMING_SNAKE_CASE ) % 2) != ...
43
0
import pytest from datasets.splits import SplitDict, SplitInfo from datasets.utils.py_utils import asdict @pytest.mark.parametrize( "split_dict" , [ SplitDict(), SplitDict({"train": SplitInfo(name="train" , num_bytes=1_3_3_7 , num_examples=4_2 , dataset_na...
54
from __future__ import annotations def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ , lowercase__ = position lowercase__ = [ (y + 1, x + 2), (y - 1, x + 2), (y + 1, x - 2), (y - 1, x - 2), ...
43
0
import importlib import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Union import torch from ..utils import BaseOutput SCREAMING_SNAKE_CASE :Optional[Any] = 'scheduler_config.json' class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ):...
55
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...schedulers import HeunDiscreteSch...
43
0
'''simple docstring''' from pickle import UnpicklingError import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict from ..utils import logging _a : List[Any] = logging.get_logger(__name__) def _a (lowe...
56
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo lowerCAmelCase = '\\n@misc{wu2016googles,\n title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yonghui ...
43
0
import inspect import unittest from transformers import MobileNetVaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import Confi...
57
import unittest from diffusers.models.unet_ad_blocks import * # noqa F403 from diffusers.utils import torch_device from .test_unet_blocks_common import UNetBlockTesterMixin class _a ( UpperCamelCase__ , unittest.TestCase ): _lowercase : Optional[Any] = Down...
43
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __lowerCAmelCase : int = logging.get_logger(__name__) __lowe...
58
def _a ( SCREAMING_SNAKE_CASE = "The quick brown fox jumps over the lazy dog" , ): """simple docstring""" lowercase__ = set() # Replace all the whitespace in our sentence lowercase__ = input_str.replace(''' ''' , '''''' ) for alpha in input_str: if "a...
43
0
import warnings 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 __A = logging.get_logger(__name__) __A = { "nvidia/seg...
59
import unicodedata from dataclasses import dataclass from typing import Optional, Union import numpy as np from transformers.data.data_collator import DataCollatorMixin from transformers.file_utils import PaddingStrategy from transformers.tokenization_utils_base import PreTrainedTokenizerBase def ...
43
0
import unittest from transformers import TrOCRConfig from transformers.testing_utils import is_torch_available, require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_t...
60
import math import time from typing import Dict, List, Optional from torch.utils.data import Dataset from transformers import SeqaSeqTrainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_...
43
0