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
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class __lowerCamelCase ( UpperCamelCase__ ...
61
'''simple docstring''' def A ( UpperCamelCase_ : str , UpperCamelCase_ : int ) -> list: '''simple docstring''' lowerCAmelCase__ = word.split() def justify(UpperCamelCase_ : list , UpperCamelCase_ : int , UpperCamelCa...
48
0
from __future__ import annotations from typing import Any class SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__( self : Optional[Any] , UpperCAmelCase_ : int , UpperCAmelCase_ : int , UpperCAmelCase_ : float...
62
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentPar...
48
0
def lowerCamelCase__ ( __lowerCamelCase : float , __lowerCamelCase : int ): if digit_amount > 0: return round(number - int(__lowerCamelCase ) , __lowerCamelCase ) return number - int(__lowerCamelCase ) if __name__ == "__main__": ...
63
'''simple docstring''' import sys from collections import defaultdict class A : def __init__( self : Any ): """simple docstring""" lowerCAmelCase__ = [] def __SCREAMING_SNAKE_CASE ( self : List[str] , __magic_name__ : ...
48
0
import torch from torch import nn from transformers import CLIPPreTrainedModel, CLIPVisionModel from ...models.attention import BasicTransformerBlock from ...utils import logging lowercase_ : int = logging.get_logger(__name__) # pylint: disable=invalid-name class _lowerCamelCase ( UpperCamelCas...
64
'''simple docstring''' import unittest from pathlib import Path from shutil import copyfile from transformers import SPIECE_UNDERLINE, is_sentencepiece_available from transformers.models.speech_to_text import SpeechaTextTokenizer from transformers.models.speech_to_text.tokenization_speech_to_text import VOCAB_FILES_...
48
0
"""simple docstring""" import unittest from typing import Tuple import torch from diffusers.utils import floats_tensor, randn_tensor, torch_all_close, torch_device from diffusers.utils.testing_utils import require_torch @require_torch class __lowercase : @property def...
65
'''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 ( TFBaseModelOutputWithNoAttention, ...
48
0
from ..utils import DummyObject, requires_backends class lowerCAmelCase_ ( metaclass=__snake_case ): _UpperCamelCase : Dict = ["torch", "scipy"] def __init__( self , *_lowerCAmelCase , **_lowerCAmelCase ): requires_backends(self , ['torc...
66
'''simple docstring''' from datetime import datetime import matplotlib.pyplot as plt import torch def A ( UpperCamelCase_ : Tuple ) -> int: '''simple docstring''' for param in module.parameters(): lowerCAmelCase__ = False def A ( ) ->...
48
0
import argparse import os import re snake_case = """src/transformers/models/auto""" # re pattern that matches mapping introductions: # SUPER_MODEL_MAPPING_NAMES = OrderedDict or SUPER_MODEL_MAPPING = OrderedDict snake_case = re.compile(R"""[A-Z_]+_MAPPING(\s+|_[A-Z...
67
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCAmelCase__ : List[Any] = {"configuration_encoder_decoder": ["EncoderDecoderConfig"]} try: i...
48
0
import re from filelock import FileLock try: import nltk __A = True except (ImportError, ModuleNotFoundError): __A = False if NLTK_AVAILABLE: with FileLock(".lock") as lock: nltk.download("punkt", quiet=True) def lowercase__ ( A_: str ) -> str: ...
68
'''simple docstring''' import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def A ( UpperCamelCase_ : Optional[int] , UpperCamelCase_ ...
48
0
'''simple docstring''' from .configuration_bert_masked import MaskedBertConfig from .modeling_bert_masked import ( MaskedBertForMultipleChoice, MaskedBertForQuestionAnswering, MaskedBertForSequenceClassification, MaskedBertForTokenClassification, MaskedBertModel, ) from .modules...
69
'''simple docstring''' from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_atte...
48
0
import argparse import re from flax.traverse_util import flatten_dict, unflatten_dict from tax import checkpoints from transformers import SwitchTransformersConfig, SwitchTransformersForConditionalGeneration from transformers.modeling_flax_pytorch_utils import load_flax_weights_in_pytorch_model from...
70
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging UpperCAmelCase__ : Tuple = logging.get_logger(__name__) UpperCAmelCase__ : List[str] = { "google/umt5-small...
48
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...
71
'''simple docstring''' from __future__ import annotations from collections import Counter from random import random class A : def __init__( self : Optional[int] ): """simple docstring""" lowerCAmelCase__ = {} def __SCREAMING_SNAKE_CASE ( self ...
48
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _UpperCAmelCase : Optional[int] = logging.get_logger(__name__) _UpperCAmelCase : Optional[int] = { '''ro...
72
'''simple docstring''' import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets from datasets import load_me...
48
0
import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class _snake_case ( ctypes.Structure ): # _fields is a specific attr expected by ctypes _lowercase : Tuple = [('''size''', ctypes.c...
73
'''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-2.0 # ...
48
0
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_ = argparse.ArgumentParser() parser.a...
74
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ : int = logging.get_logger(__name__) class A ( SCREAMING_SNAKE_CASE__ ): snake_case__ :Any = 'timm_backbone' def __init__( self : Tuple ...
48
0
'''simple docstring''' import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format='''%(message)s''') def a__ ( lowerCAmelCase__ ) -> np.ndarray: return input_array.reshape((input_array.size, 1) ) ...
75
'''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-2.0 # ...
48
0
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/...
76
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ : Tuple = logging.get_logger(__na...
48
0
"""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_convbert import ConvBertTokenizer A = logging.get_logger(__name__) A = ...
77
'''simple docstring''' from random import randint from tempfile import TemporaryFile import numpy as np def A ( UpperCamelCase_ : List[Any] , UpperCamelCase_ : int , UpperCamelCase_ : List[Any] ) -> Dict: '''simple docstring''' lowerCAmelC...
48
0
'''simple docstring''' SCREAMING_SNAKE_CASE_: Optional[int] =[ 'Audio', 'Array2D', 'Array3D', 'Array4D', 'Array5D', 'ClassLabel', 'Features', 'Sequence', 'Value', 'Image', 'Translation', 'TranslationVariableLanguages', ] from .audio import Audio from .features imp...
78
'''simple docstring''' import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def A ( UpperCamelCase_ : List[Any] ) -> Tuple: '''simple docstring''' if "img_encoder.pos_embed" in name: ...
48
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 # # U...
79
'''simple docstring''' from __future__ import annotations from functools import lru_cache from math import ceil UpperCAmelCase__ : Optional[Any] = 1_00 UpperCAmelCase__ : Any = set(range(3, NUM_PRIMES, 2)) primes.add(2) UpperCAmelCase__ : int for prime in range(3, ceil(NUM_PRIMES**0.5)...
48
0
import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionPipeline from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device __UpperCamelCase : Union[str, Any] = False class __UpperCamelCase ...
80
'''simple docstring''' import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ : List[Any] = logging.get_logger(__name__) UpperCAmelCase__ : List[str] = {"vocab_file": "vocab.json"} Uppe...
48
0
from numpy import exp, pi, sqrt def lowerCAmelCase_ ( __lowerCamelCase , __lowerCamelCase = 0.0 , __lowerCamelCase = 1.0 ): return 1 / sqrt(2 * pi * sigma**2 ) * exp(-((x - mu) ** 2) / (2 * sigma**2) ) if __name__ == "__main__": import doctest doctest.te...
81
'''simple docstring''' from math import sqrt def A ( UpperCamelCase_ : int ) -> int: '''simple docstring''' lowerCAmelCase__ = 0 for i in range(1 , int(sqrt(UpperCamelCase_ ) + 1 ) ): if n % i == 0 and i != sqrt(UpperCamelCase_ ): ...
48
0
"""simple docstring""" import argparse import logging import pickle from collections import Counter logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""", level=logging.INFO ) lowerCamelCase = logging.getLogger(__na...
82
'''simple docstring''' import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format="%(message)s") def A ( UpperCamelCase_ : np.ndarray ) -> np.ndarray: '''simple docstring''' return input_array.reshape((...
48
0
"""simple docstring""" def snake_case_ ( A_ : int ): '''simple docstring''' if not isinstance(A_, A_ ): raise ValueError('''check_bouncy() accepts only integer arguments''' ) _lowerCamelCase : Tuple = str(A_ ) _lower...
83
'''simple docstring''' def A ( UpperCamelCase_ : str , UpperCamelCase_ : int ) -> list: '''simple docstring''' lowerCAmelCase__ = word.split() def justify(UpperCamelCase_ : list , UpperCamelCase_ : int , UpperCamelCa...
48
0
from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass UpperCAmelCase = (3, 9, -11, 0, 7, 5, 1, -1) UpperCAmelCase = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class A_ : '''simple docstring''' _UpperCamelCase : int _Uppe...
84
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentPar...
48
0
from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration SCREAMING_SNAKE_CASE__ : List[str] = HfArgumentParser(InitializationArguments) SCREAMING_SNAKE_CASE__ : Tuple = pa...
85
'''simple docstring''' import sys from collections import defaultdict class A : def __init__( self : Any ): """simple docstring""" lowerCAmelCase__ = [] def __SCREAMING_SNAKE_CASE ( self : List[str] , __magic_name__ : ...
48
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __a :List[str] = logging.get_logger(__name__) class _a ( snake_case_ ): """simple docstring""" _lowerCamelCase : Tuple = 'timm_backbone' def __...
86
'''simple docstring''' import unittest from pathlib import Path from shutil import copyfile from transformers import SPIECE_UNDERLINE, is_sentencepiece_available from transformers.models.speech_to_text import SpeechaTextTokenizer from transformers.models.speech_to_text.tokenization_speech_to_text import VOCAB_FILES_...
48
0
import argparse import json import os from collections import OrderedDict import torch from transformers import LukeConfig, LukeForMaskedLM, MLukeTokenizer, XLMRobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def SCREAMING_SNAKE_CASE ( lowercase_ , ...
87
'''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 ( TFBaseModelOutputWithNoAttention, ...
48
0
"""simple docstring""" import os from pathlib import Path def _snake_case ( ): """simple docstring""" from torch.utils.cpp_extension import load _lowerCamelCase : Optional[Any] = Path(__snake_case ).resolve().parent.parent.parent / """kernels""" / """de...
88
'''simple docstring''' from datetime import datetime import matplotlib.pyplot as plt import torch def A ( UpperCamelCase_ : Tuple ) -> int: '''simple docstring''' for param in module.parameters(): lowerCAmelCase__ = False def A ( ) ->...
48
0
from __future__ import annotations import numpy as np def UpperCamelCase_( lowerCamelCase_ ) -> Optional[int]: return np.maximum(0 , lowerCamelCase_ ) if __name__ == "__main__": print(np.array(relu([-1, 0, 5]))) # --> [0, 0, 5]
89
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCAmelCase__ : List[Any] = {"configuration_encoder_decoder": ["EncoderDecoderConfig"]} try: i...
48
0
'''simple docstring''' from unittest.mock import Mock, patch from file_transfer.send_file import send_file @patch('''socket.socket''' ) @patch('''builtins.open''' ) def _snake_case ( A , A ) -> List[Any]: # ===== initialization ===== lowerCAmelCase...
90
'''simple docstring''' import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def A ( UpperCamelCase_ : Optional[int] , UpperCamelCase_ ...
48
0
"""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 if is_torch_available(): import torch...
91
'''simple docstring''' from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_atte...
48
0
'''simple docstring''' def _lowerCAmelCase ( __magic_name__ : int = 1000 ) -> int: lowercase : Optional[Any] =2**power lowercase : Dict =0 while n: lowercase , lowercase : Optional[Any] =r + n % 10, n // 10 return r ...
92
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging UpperCAmelCase__ : Tuple = logging.get_logger(__name__) UpperCAmelCase__ : List[str] = { "google/umt5-small...
48
0
"""simple docstring""" import random def __A (_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) ->Optional[int]: """simple docstring""" lowerCAmelCase__ :Optional[Any] = a[left_index] lowerCAmelCase__ :Tuple = left_index + 1 ...
93
'''simple docstring''' from __future__ import annotations from collections import Counter from random import random class A : def __init__( self : Optional[int] ): """simple docstring""" lowerCAmelCase__ = {} def __SCREAMING_SNAKE_CASE ( self ...
48
0
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bart i...
94
'''simple docstring''' import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets from datasets import load_me...
48
0
"""simple docstring""" import gc import unittest import numpy as np import torch from torch.backends.cuda import sdp_kernel from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) from diffusers.utils import randn_tensor, slow, torch_device from diffusers.ut...
95
'''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-2.0 # ...
48
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteSched...
96
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ : int = logging.get_logger(__name__) class A ( SCREAMING_SNAKE_CASE__ ): snake_case__ :Any = 'timm_backbone' def __init__( self : Tuple ...
48
0
import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __a = logging.get_logger(__name__) __a = { 'vocab_file': 'vocab.json', 'tokenizer_config_file': 'tokenizer_config.json',...
97
'''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-2.0 # ...
48
0
'''simple docstring''' import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin lowercase__ : Optional[int] = '\nHugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that devel...
98
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ : Tuple = logging.get_logger(__na...
48
0
import collections import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_CASE = logging.get_logger(__name__) SCREAMING_SNAKE_CASE = ...
99
'''simple docstring''' from random import randint from tempfile import TemporaryFile import numpy as np def A ( UpperCamelCase_ : List[Any] , UpperCamelCase_ : int , UpperCamelCase_ : List[Any] ) -> Dict: '''simple docstring''' lowerCAmelC...
48
0
import importlib.util import os import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import ( is_accelerate_available, is_flax_available, is_safetensors_available, is_tf_available, is_torch_available, ) from . import Ba...
100
'''simple docstring''' import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def A ( UpperCamelCase_ : List[Any] ) -> Tuple: '''simple docstring''' if "img_encoder.pos_embed" in name: ...
48
0
def a__ ( A__, A__, A__, A__ ): SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ : Optional[int] = len(A__ ), len(grid[0] ) if ( min(A__, A__ ) < 0 or row == row_length or col == col_length or (row, col) in visit ...
101
'''simple docstring''' from __future__ import annotations from functools import lru_cache from math import ceil UpperCAmelCase__ : Optional[Any] = 1_00 UpperCAmelCase__ : Any = set(range(3, NUM_PRIMES, 2)) primes.add(2) UpperCAmelCase__ : int for prime in range(3, ceil(NUM_PRIMES**0.5)...
48
0
"""simple docstring""" def UpperCamelCase (SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): UpperCamelCase : List[Any] = """""" for i in table: res += inp[i - 1] return res def UpperCamelCase (SCREAMING_SNAKE_CASE ):...
102
'''simple docstring''' import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ : List[Any] = logging.get_logger(__name__) UpperCAmelCase__ : List[str] = {"vocab_file": "vocab.json"} Uppe...
48
0
"""simple docstring""" import torch from transformers import CamembertForMaskedLM, CamembertTokenizer def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_=5 ) -> List[str]: # Adapted from https://github.com/pytorch/fair...
103
'''simple docstring''' from math import sqrt def A ( UpperCamelCase_ : int ) -> int: '''simple docstring''' lowerCAmelCase__ = 0 for i in range(1 , int(sqrt(UpperCamelCase_ ) + 1 ) ): if n % i == 0 and i != sqrt(UpperCamelCase_ ): ...
48
0
"""simple docstring""" from .imports import is_tqdm_available if is_tqdm_available(): from tqdm.auto import tqdm as _tqdm from ..state import PartialState def _lowerCamelCase ( UpperCAmelCase_ : bool = True, *UpperCAmelCase_ : List[Any], **UpperCAmelCase_...
104
'''simple docstring''' import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format="%(message)s") def A ( UpperCamelCase_ : np.ndarray ) -> np.ndarray: '''simple docstring''' return input_array.reshape((...
48
0
import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassificationWithTeacher, EfficientFormer...
105
'''simple docstring''' def A ( UpperCamelCase_ : str , UpperCamelCase_ : int ) -> list: '''simple docstring''' lowerCAmelCase__ = word.split() def justify(UpperCamelCase_ : list , UpperCamelCase_ : int , UpperCamelCa...
48
0
import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def lowerCamelCase_ ( lowerCAmelCase__ : List[str] ) -> Tuple: '''simple docstring''' if "img_encoder.pos_embed" in name: ...
106
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentPar...
48
0
'''simple docstring''' import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as j...
107
'''simple docstring''' import sys from collections import defaultdict class A : def __init__( self : Any ): """simple docstring""" lowerCAmelCase__ = [] def __SCREAMING_SNAKE_CASE ( self : List[str] , __magic_name__ : ...
48
0
import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class SCREAMING_SNAKE_CASE__ ( UpperCAmelCase ): '''simple docstri...
108
'''simple docstring''' import unittest from pathlib import Path from shutil import copyfile from transformers import SPIECE_UNDERLINE, is_sentencepiece_available from transformers.models.speech_to_text import SpeechaTextTokenizer from transformers.models.speech_to_text.tokenization_speech_to_text import VOCAB_FILES_...
48
0
'''simple docstring''' from __future__ import annotations from PIL import Image # Define glider example a = [ [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0...
109
'''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 ( TFBaseModelOutputWithNoAttention, ...
48
0
"""simple docstring""" from typing import List import jiwer import jiwer.transforms as tr from packaging import version import datasets from datasets.config import PY_VERSION if PY_VERSION < version.parse('3.8'): import importlib_metadata else: import importlib.metadata as importlib_metadata UpperCame...
110
'''simple docstring''' from datetime import datetime import matplotlib.pyplot as plt import torch def A ( UpperCamelCase_ : Tuple ) -> int: '''simple docstring''' for param in module.parameters(): lowerCAmelCase__ = False def A ( ) ->...
48
0
def lowerCAmelCase__ ( ) -> int: '''simple docstring''' A__ = [] A__ = 1 while len(UpperCamelCase_ ) < 1e6: constant.append(str(UpperCamelCase_ ) ) i += 1 A__ = "".join(UpperCamelCase_ ) return ...
514
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCAmelCase__ : List[Any] = {"configuration_encoder_decoder": ["EncoderDecoderConfig"]} try: i...
48
0
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings UpperCAmelCase__ = R"\n [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and\n can be used to control th...
186
'''simple docstring''' import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def A ( UpperCamelCase_ : Optional[int] , UpperCamelCase_ ...
48
0
'''simple docstring''' lowerCamelCase :str = {"a": ["c", "b"], "b": ["d", "e"], "c": [], "d": [], "e": []} lowerCamelCase :Any = ["a", "b", "c", "d", "e"] def a ( lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ ): '''simple docstring''' ...
667
'''simple docstring''' from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_atte...
48
0
from itertools import permutations def snake_case__ ( lowerCamelCase_ ): if num[3] % 2 != 0: return False if (num[2] + num[3] + num[4]) % 3 != 0: return False if num[5] % 5 != 0: return False A : ...
542
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging UpperCAmelCase__ : Tuple = logging.get_logger(__name__) UpperCAmelCase__ : List[str] = { "google/umt5-small...
48
0
'''simple docstring''' import argparse import copy def _SCREAMING_SNAKE_CASE ( __snake_case : str ): _A = {} with open(UpperCamelCase_ ) as f: for line in f: if line.split()[0] not in dict_of_neighbours: _A = [] ...
107
'''simple docstring''' from __future__ import annotations from collections import Counter from random import random class A : def __init__( self : Optional[int] ): """simple docstring""" lowerCAmelCase__ = {} def __SCREAMING_SNAKE_CASE ( self ...
48
0
import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, iflatmap_unordered, map_nested, ...
315
'''simple docstring''' import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets from datasets import load_me...
48
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available snake_case__ : List[str] = { "configuration_lilt": ["LILT_PRETRAINED_CONFIG_ARCHIVE_MAP", "LiltConfig"], } try: if not is_torch_available(): raise OptionalDe...
408
'''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-2.0 # ...
48
0
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class snake_case_ : '''simple docstring''' def __init__( self : Dict , __magic_name__ : Collection[float] | None = None ...
488
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ : int = logging.get_logger(__name__) class A ( SCREAMING_SNAKE_CASE__ ): snake_case__ :Any = 'timm_backbone' def __init__( self : Tuple ...
48
0
"""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 __SCREAMING_SNAKE_CASE ( A_ ): return (d...
450
'''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-2.0 # ...
48
0
import argparse import os import torch from transformers import FlavaConfig, FlavaForPreTraining from transformers.models.flava.convert_dalle_to_flava_codebook import convert_dalle_checkpoint def snake_case ( snake_case__ :Dict) -> List[str]: return sum(param.float().sum() i...
401
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ : Tuple = logging.get_logger(__na...
48
0
'''simple docstring''' import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor __snake_case = logging.get_logger(__name__) class _a ( SCREAMING_SNAKE_CASE__ ): """simple docstring""" def __init__( self : int , *lowerca...
451
'''simple docstring''' from random import randint from tempfile import TemporaryFile import numpy as np def A ( UpperCamelCase_ : List[Any] , UpperCamelCase_ : int , UpperCamelCase_ : List[Any] ) -> Dict: '''simple docstring''' lowerCAmelC...
48
0
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Optional[Any] , SCREAMING_SNAKE_CASE_: Optional[int] ) -> int: '''simple docstring''' A__ = 0 while b > 0: if b & 1: res += a a += a b >>= 1 return res ...
514
'''simple docstring''' import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def A ( UpperCamelCase_ : List[Any] ) -> Tuple: '''simple docstring''' if "img_encoder.pos_embed" in name: ...
48
0
'''simple docstring''' import json import logging import math import os import sys from dataclasses import dataclass, field from typing import Optional from datasets import Dataset, load_dataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_FOR_MASKED_LM_MAPPING, AutoConfig,...
186
'''simple docstring''' from __future__ import annotations from functools import lru_cache from math import ceil UpperCAmelCase__ : Optional[Any] = 1_00 UpperCAmelCase__ : Any = set(range(3, NUM_PRIMES, 2)) primes.add(2) UpperCAmelCase__ : int for prime in range(3, ceil(NUM_PRIMES**0.5)...
48
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase :Optional[int] = { "configuratio...
667
'''simple docstring''' import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ : List[Any] = logging.get_logger(__name__) UpperCAmelCase__ : List[str] = {"vocab_file": "vocab.json"} Uppe...
48
0
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_available(): i...
542
'''simple docstring''' from math import sqrt def A ( UpperCamelCase_ : int ) -> int: '''simple docstring''' lowerCAmelCase__ = 0 for i in range(1 , int(sqrt(UpperCamelCase_ ) + 1 ) ): if n % i == 0 and i != sqrt(UpperCamelCase_ ): ...
48
0
'''simple docstring''' from numpy import exp, pi, sqrt def _SCREAMING_SNAKE_CASE ( __snake_case : int , __snake_case : float = 0.0 , __snake_case : float = 1.0 ): return 1 / sqrt(2 * pi * sigma**2 ) * exp(-((x - mu) ** 2) / (2 * sigma**2) ) if __name__ == ...
107
'''simple docstring''' import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format="%(message)s") def A ( UpperCamelCase_ : np.ndarray ) -> np.ndarray: '''simple docstring''' return input_array.reshape((...
48
0
import argparse import json import subprocess def _a ( UpperCAmelCase , UpperCAmelCase ) -> List[str]: """simple docstring""" lowerCamelCase__ : Optional[int] = [] lowerCamelCase__ : List[Any] = ( f"curl -H \"Accept: application/vnd.github+...
315
'''simple docstring''' def A ( UpperCamelCase_ : str , UpperCamelCase_ : int ) -> list: '''simple docstring''' lowerCAmelCase__ = word.split() def justify(UpperCamelCase_ : list , UpperCamelCase_ : int , UpperCamelCa...
48
0
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, StableDiffusionPanoramaPipeline, UNet...
408
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentPar...
48
0
import logging import os from typing import List, TextIO, Union from conllu import parse_incr from utils_ner import InputExample, Split, TokenClassificationTask snake_case_ : Union[str, Any] = logging.getLogger(__name__) class snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''simple docs...
488
'''simple docstring''' import sys from collections import defaultdict class A : def __init__( self : Any ): """simple docstring""" lowerCAmelCase__ = [] def __SCREAMING_SNAKE_CASE ( self : List[str] , __magic_name__ : ...
48
0
"""simple docstring""" from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType clas...
450
'''simple docstring''' import unittest from pathlib import Path from shutil import copyfile from transformers import SPIECE_UNDERLINE, is_sentencepiece_available from transformers.models.speech_to_text import SpeechaTextTokenizer from transformers.models.speech_to_text.tokenization_speech_to_text import VOCAB_FILES_...
48
0
from __future__ import annotations from collections.abc import Sequence from typing import Literal def snake_case ( snake_case__ :str , snake_case__ :str) -> str | Literal[False]: _A = list(UpperCamelCase_) _A = list(UpperCamelCase_) _A = ...
401
'''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 ( TFBaseModelOutputWithNoAttention, ...
48
0
'''simple docstring''' def A_ ( SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ) ->List[Any]: lowercase_ = 0 lowercase_ = len(UpperCamelCase_ ) - 1 while left <= right: # avoid divided by 0 during interpolation if sorted_collection[left] == sorted_collection[...
451
'''simple docstring''' from datetime import datetime import matplotlib.pyplot as plt import torch def A ( UpperCamelCase_ : Tuple ) -> int: '''simple docstring''' for param in module.parameters(): lowerCAmelCase__ = False def A ( ) ->...
48
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 lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { "facebook/data2vec-...
514
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCAmelCase__ : List[Any] = {"configuration_encoder_decoder": ["EncoderDecoderConfig"]} try: i...
48
0
'''simple docstring''' from PIL import Image def UpperCAmelCase__( _SCREAMING_SNAKE_CASE : Image,_SCREAMING_SNAKE_CASE : int ): """simple docstring""" __A= (259 * (level + 255)) / (255 * (259 - level)) def contrast(_SCREAMING_SNAKE_CASE : int ) -> int: return...
186
'''simple docstring''' import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def A ( UpperCamelCase_ : Optional[int] , UpperCamelCase_ ...
48
0
'''simple docstring''' from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils i...
667
'''simple docstring''' from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_atte...
48
0
from math import sqrt def snake_case__ ( lowerCamelCase_ ): A : str = 0 for i in range(1 , int(sqrt(UpperCamelCase_ ) + 1 ) ): if n % i == 0 and i != sqrt(UpperCamelCase_ ): total += i + n // i ...
542
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging UpperCAmelCase__ : Tuple = logging.get_logger(__name__) UpperCAmelCase__ : List[str] = { "google/umt5-small...
48
0
'''simple docstring''' import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list ...
107
'''simple docstring''' from __future__ import annotations from collections import Counter from random import random class A : def __init__( self : Optional[int] ): """simple docstring""" lowerCAmelCase__ = {} def __SCREAMING_SNAKE_CASE ( self ...
48
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _A : str = logging.get_logger(__name__) _A : int = { "weiweishi/roc-bert-base-zh": "https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.json", } class __SCREAMING_SNA...
315
'''simple docstring''' import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets from datasets import load_me...
48
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available snake_case__ : Optional[Any] = {"configuration_timm_backbone": ["TimmBackboneConfig"]} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() ...
408
'''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-2.0 # ...
48
0
def __a ( __UpperCAmelCase : int ) -> str: """simple docstring""" lowerCamelCase_ : Any = int(UpperCamelCase_ ) if decimal in (0, 1): # Exit cases for the recursion return str(UpperCamelCase_ ) lowerCamelCase_ ...
488
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ : int = logging.get_logger(__name__) class A ( SCREAMING_SNAKE_CASE__ ): snake_case__ :Any = 'timm_backbone' def __init__( self : Tuple ...
48
0
"""simple docstring""" import argparse import hashlib # hashlib is only used inside the Test class import struct class SCREAMING_SNAKE_CASE : """simple docstring""" def __init__( self : Optional[Any] ,lowercase_ : Any ): lowerCAmelCase__ ...
450
'''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-2.0 # ...
48
0
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_full_det...
401
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ : Tuple = logging.get_logger(__na...
48
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __snake_case = { "configuration_jukebox": [ "JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP", "JukeboxConfig", "JukeboxPriorConfig", "Jukeb...
451
'''simple docstring''' from random import randint from tempfile import TemporaryFile import numpy as np def A ( UpperCamelCase_ : List[Any] , UpperCamelCase_ : int , UpperCamelCase_ : List[Any] ) -> Dict: '''simple docstring''' lowerCAmelC...
48
0
import random import unittest import torch from diffusers import IFInpaintingPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import ( TEXT_GUIDED_IMAGE_INPAI...
514
'''simple docstring''' import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def A ( UpperCamelCase_ : List[Any] ) -> Tuple: '''simple docstring''' if "img_encoder.pos_embed" in name: ...
48
0
'''simple docstring''' import importlib import inspect import os import re # 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 UpperCAmelCase__ = "src/transformers" # This is to make sure the transformers ...
186
'''simple docstring''' from __future__ import annotations from functools import lru_cache from math import ceil UpperCAmelCase__ : Optional[Any] = 1_00 UpperCAmelCase__ : Any = set(range(3, NUM_PRIMES, 2)) primes.add(2) UpperCAmelCase__ : int for prime in range(3, ceil(NUM_PRIMES**0.5)...
48
0
'''simple docstring''' def a ( lowerCamelCase__ , lowerCamelCase__ ): '''simple docstring''' A_ : Tuple = [[] for _ in range(UpperCamelCase_ )] A_ : Any = key - 1 if key <= 0: raise ValueError("""Height of grid can't be 0 or negative""" ...
667
'''simple docstring''' import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ : List[Any] = logging.get_logger(__name__) UpperCAmelCase__ : List[str] = {"vocab_file": "vocab.json"} Uppe...
48
0
import tempfile import unittest import numpy as np from diffusers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionPipeline, PNDMScheduler, ) from diffusers.utils.testing...
542
'''simple docstring''' from math import sqrt def A ( UpperCamelCase_ : int ) -> int: '''simple docstring''' lowerCAmelCase__ = 0 for i in range(1 , int(sqrt(UpperCamelCase_ ) + 1 ) ): if n % i == 0 and i != sqrt(UpperCamelCase_ ): ...
48
0
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roberta im...
107
'''simple docstring''' import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format="%(message)s") def A ( UpperCamelCase_ : np.ndarray ) -> np.ndarray: '''simple docstring''' return input_array.reshape((...
48
0
from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ......
315
'''simple docstring''' def A ( UpperCamelCase_ : str , UpperCamelCase_ : int ) -> list: '''simple docstring''' lowerCAmelCase__ = word.split() def justify(UpperCamelCase_ : list , UpperCamelCase_ : int , UpperCamelCa...
48
0
import re from filelock import FileLock try: import nltk snake_case__ : Union[str, Any] = True except (ImportError, ModuleNotFoundError): snake_case__ : Tuple = False if NLTK_AVAILABLE: with FileLock('.lock') as lock: nltk.download('punkt', q...
408
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentPar...
48
0
import argparse import os import re import numpy as np import PIL import torch from timm import create_model from torch.optim.lr_scheduler import OneCycleLR from torch.utils.data import DataLoader, Dataset from torchvision.transforms import Compose, RandomResizedCrop, Resize, ToTensor from accelerate import Acce...
488
'''simple docstring''' import sys from collections import defaultdict class A : def __init__( self : Any ): """simple docstring""" lowerCAmelCase__ = [] def __SCREAMING_SNAKE_CASE ( self : List[str] , __magic_name__ : ...
48
0
"""simple docstring""" import doctest import sys import warnings from os.path import abspath, dirname, join import _pytest from transformers.testing_utils import HfDoctestModule, HfDocTestParser # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when s...
450
'''simple docstring''' import unittest from pathlib import Path from shutil import copyfile from transformers import SPIECE_UNDERLINE, is_sentencepiece_available from transformers.models.speech_to_text import SpeechaTextTokenizer from transformers.models.speech_to_text.tokenization_speech_to_text import VOCAB_FILES_...
48
0
from __future__ import annotations _SCREAMING_SNAKE_CASE = "Muhammad Umer Farooq" _SCREAMING_SNAKE_CASE = "MIT" _SCREAMING_SNAKE_CASE = "1.0.0" _SCREAMING_SNAKE_CASE = "Muhammad Umer Farooq" _SCREAMING_SNAKE_CASE = "contact@muhammadumerfarooq.me" _SCREAMING_SNAKE_CAS...
401
'''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 ( TFBaseModelOutputWithNoAttention, ...
48
0
'''simple docstring''' __snake_case = 8.314462 # Unit - J mol-1 K-1 def A_ ( SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ) ->float: if moles < 0 or kelvin < 0 or volume < 0: raise ValueError("""Invalid inputs. Enter positive value.""" ) return mo...
451
'''simple docstring''' from datetime import datetime import matplotlib.pyplot as plt import torch def A ( UpperCamelCase_ : Tuple ) -> int: '''simple docstring''' for param in module.parameters(): lowerCAmelCase__ = False def A ( ) ->...
48
0
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 is_torch_available(): impor...
514
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCAmelCase__ : List[Any] = {"configuration_encoder_decoder": ["EncoderDecoderConfig"]} try: i...
48
0
'''simple docstring''' import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFGPTaLMHeadModel, is_keras_nlp_available, is_tf_available from transformers.models.gpta.tokenization_gpta import GPTaTokenizer from transformers.testing_utils import req...
186
'''simple docstring''' import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def A ( UpperCamelCase_ : Optional[int] , UpperCamelCase_ ...
48
0
'''simple docstring''' import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, Features, Value from .base import TaskTemplate @dataclass(frozen=SCREAMING_SNAKE_CASE__ ) class _lowerCAmelCase ( SCREAMING_SNAKE_CASE__ ): __...
667
'''simple docstring''' from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_atte...
48
0
def snake_case__ ( lowerCamelCase_ ): A : Dict = len(UpperCamelCase_ ) for i in range(UpperCamelCase_ ): for j in range(i + 1 , UpperCamelCase_ ): if numbers[j] < numbers[i]: A , A : ...
542
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging UpperCAmelCase__ : Tuple = logging.get_logger(__name__) UpperCAmelCase__ : List[str] = { "google/umt5-small...
48
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configurati...
107
'''simple docstring''' from __future__ import annotations from collections import Counter from random import random class A : def __init__( self : Optional[int] ): """simple docstring""" lowerCAmelCase__ = {} def __SCREAMING_SNAKE_CASE ( self ...
48
0
from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _A : Tuple = datasets.load_iris() _A : Any = np.array(data['data']) _A : Union[str, Any] = np.array(data['target']) _A ...
315
'''simple docstring''' import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets from datasets import load_me...
48
0