code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase_ = {"configuration_opt": ["OPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "OPTConfig"]} ...
360
from collections.abc import Sequence def _snake_case( SCREAMING_SNAKE_CASE__ : Sequence[int] | None = None ) -> int: '''simple docstring''' if nums is None or not nums: raise ValueError('Input sequence should not be empty' ) A__ ...
282
0
"""simple docstring""" import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": lowercase_ = argparse.ArgumentParser() parser.add_argument( "--checkpoint_path...
361
def _snake_case( SCREAMING_SNAKE_CASE__ : int = 1000 ) -> int: '''simple docstring''' A__ = 3 A__ = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 15 == 0: res...
282
0
import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel lowercase_ = HfApi() lowercase_ = {} # fmt: off lowercase_ = torch.tensor([ -0.7_515, -1.6_883, 0.2_420, 0.0_300, 0.6_347, 1.3_433, -1.1_743, -3.7_467, 1.2_342, -2.2_485, 0.4_636, 0.8_0...
362
import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu, calculate_rou...
282
0
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaControlnetImgaImgPipeline, KandinskyVaaPriorEmbaEmbPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tenso...
363
import random def _snake_case( SCREAMING_SNAKE_CASE__ : list , SCREAMING_SNAKE_CASE__ : str ) -> tuple: '''simple docstring''' A__ , A__ , A__ = [], [], [] for element in data: if element < pivot:...
282
0
def _snake_case( SCREAMING_SNAKE_CASE__ : str ) -> bool: '''simple docstring''' return credit_card_number.startswith(('34', '35', '37', '4', '5', '6') ) def _snake_case( SCREAMING_SNAKE_CASE__ : str ) -> bool: ...
364
from __future__ import annotations from scipy.special import comb # type: ignore class A : """simple docstring""" def __init__( self : Any,lowercase_ : list[tuple[float, float]] )-> Optional[int]: '''simple docstring''' ...
282
0
from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax import FlaxTimestepEmb...
365
import unittest from transformers import LiltConfig, 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 ModelTesterMi...
282
0
import pytest from datasets.utils.sharding import _distribute_shards, _number_of_shards_in_gen_kwargs, _split_gen_kwargs @pytest.mark.parametrize( 'kwargs, expected' , [ ({'num_shards': 0, 'max_num_jobs': 1}, []), ({'num_shards': 10, 'max_num_jobs': 1}, [range(10 )]), (...
366
from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass lowercase_ = (3, 9, -11, 0, 7, 5, 1, -1) lowercase_ = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class A : """simple docstring""" lowerCamelCas...
282
0
import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate lowercase_ = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=DataRow("", "|", "|"), datarow=Data...
367
import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) class A ( nn.M...
282
0
from typing import List from .keymap import KEYMAP, get_character def _snake_case( SCREAMING_SNAKE_CASE__ : str ) -> Optional[int]: '''simple docstring''' def decorator(SCREAMING_SNAKE_CASE__ : Optional[Any] ): A__ = g...
368
import argparse import struct import unittest class A : """simple docstring""" def __init__( self : Any,lowercase_ : bytes )-> None: '''simple docstring''' A__ = data # Initialize hash values ...
282
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase_ = { "configuration_convbert": ["CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "ConvBertConfig", "ConvBe...
369
import numpy as np from transformers import Pipeline def _snake_case( SCREAMING_SNAKE_CASE__ : int ) -> int: '''simple docstring''' A__ = np.max(SCREAMING_SNAKE_CASE__ , axis=-1 , keepdims=SCREAMING_SNAKE_CASE__ ) A__...
282
0
import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) class A ( nn.M...
370
import comet # From: unbabel-comet import torch import datasets lowercase_ = datasets.logging.get_logger(__name__) lowercase_ = "\\n@inproceedings{rei-EtAl:2020:WMT,\n author = {Rei, Ricardo and Stewart, Craig and Farinha, Ana C and Lavie, Alon},\n title = {Unbabel's Participatio...
282
0
"""simple docstring""" import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class A ( unittest.Tes...
371
from __future__ import annotations from typing import Any def _snake_case( SCREAMING_SNAKE_CASE__ : list ) -> int: '''simple docstring''' if not postfix_notation: return 0 A__ = {'+', '-', '*', '/'} A__ = [...
282
0
'''simple docstring''' import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __A =logging.get_logger(__name__) __A ={'vocab_file': 'vocab.json'} __A ={ 'vocab_file': { 'mgp-str': 'https:/...
283
'''simple docstring''' import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class _snake_case ( a__ ): lowerCAmelCase :Optional[int] = '''''' lowerCAmelCase :str ...
283
1
'''simple docstring''' import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, ...
283
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ ): UpperCAmelCase__ : List[str] = len(UpperCamelCase__ ) UpperCAmelCase__ : List[Any] = sum(UpperCamelCase__ ) UpperCAmelCase__ : List[str] = [[Fals...
283
1
'''simple docstring''' def _UpperCamelCase ( ): UpperCAmelCase__ : int = [] UpperCAmelCase__ : Dict = 1 while len(UpperCamelCase__ ) < 1e6: constant.append(str(UpperCamelCase__ ) ) i += 1 UpperCAmelCase__ : ...
283
'''simple docstring''' import functools def _UpperCamelCase ( UpperCamelCase__ , UpperCamelCase__ ): # Validation if not isinstance(UpperCamelCase__ , UpperCamelCase__ ) or not all(isinstance(UpperCamelCase__ , UpperCamelCase__ ) for day in days ): raise V...
283
1
'''simple docstring''' import argparse import json import os import tensorstore as ts import torch from flax import serialization from flax.traverse_util import flatten_dict, unflatten_dict from tensorflow.io import gfile from transformers.modeling_utils import dtype_byte_size from transformer...
283
'''simple docstring''' import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, i...
283
1
'''simple docstring''' import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def _UpperCamelCase ( UpperCamelCase__ = 3 ): if isinstance(UpperCamelCase__ , UpperCamelCase__ ): raise Type...
283
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ = 1_0 , UpperCamelCase__ = 2_2 ): UpperCAmelCase__ : List[str] = range(1 , UpperCamelCase__ ) UpperCAmelCase__ : int = range(1 , UpperCamelCase__ ) return sum( 1 fo...
283
1
'''simple docstring''' import argparse import torch from transformers import YosoConfig, YosoForMaskedLM def _UpperCamelCase ( UpperCamelCase__ ): if "model" in orig_key: UpperCAmelCase__ : List[str] = orig_key.replace("""model.""" , """"""...
283
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __A ={ 'configuration_m2m_100': ['M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP', 'M2M100Config', 'M2M100OnnxConfig'], 'tokenizati...
283
1
'''simple docstring''' import requests __A ='' # <-- Put your OpenWeatherMap appid here! __A ='https://api.openweathermap.org/data/2.5/' def _UpperCamelCase ( UpperCamelCase__ = "Chicago" , UpperCamelCase__ = APPID ): return requests.get(URL_BASE + """weather""" , par...
283
'''simple docstring''' import os import unicodedata 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 SPIECE_UNDERLINE, logging __A =logging.get_l...
283
1
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transfo...
283
'''simple docstring''' from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _snake_case ( ...
283
1
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ ): return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('Program to check whether a number is a Perfect number or not...') __A =int(input('Enter number...
283
'''simple docstring''' import numpy class _snake_case : def __init__( self , _lowerCamelCase , _lowerCamelCase): UpperCAmelCase__ : Dict = input_array # Random initial weights are assigned where first argument is t...
283
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __A =logging.get_logger(__name__) __A ={ 'weiweishi/roc-bert-base-zh': 'https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.json', } class _snake_case ( ...
283
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transfo...
283
1
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ = 3 , UpperCamelCase__ = 7 , UpperCamelCase__ = 1_0_0_0_0_0_0 ): UpperCAmelCase__ : List[str] = 0 UpperCAmelCase__ : int = 1 for current_denominator in range(1 , limit + 1 ...
283
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import tensorflow as tf from transformers import Au...
283
1
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple import torch from torch import nn from transformers import RobertaPreTrainedModel, XLMRobertaConfig, XLMRobertaModel from transformers.utils import ModelOutput @dataclass class _snake_case ( ...
283
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ = 4_0_0_0_0_0_0 ): UpperCAmelCase__ : List[str] = [0, 1] UpperCAmelCase__ : Any = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib[i + 2] > n: ...
283
1
'''simple docstring''' import math def _UpperCamelCase ( UpperCamelCase__ ): UpperCAmelCase__ : Dict = [] UpperCAmelCase__ : List[Any] = 2 UpperCAmelCase__ : Union[str, Any] = int(math.sqrt(UpperCamelC...
283
'''simple docstring''' import re import string from collections import Counter import sacrebleu import sacremoses from packaging import version import datasets __A ='\n@inproceedings{xu-etal-2016-optimizing,\n title = {Optimizing Statistical Machine Translation for Text Simplification},\...
283
1
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ = 1_0 ): if not isinstance(UpperCamelCase__ , UpperCamelCase__ ) or n < 0: raise ValueError("""Invalid input""" ) UpperCAmelCase__ : Optional[Any] = 1_0**n UpperCAmelCase__ : List[s...
283
'''simple docstring''' import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class _snake_case ( unittest.TestCase ): def snake_case__ ( self): UpperCAmelCase__ : ...
283
1
'''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 ...
283
'''simple docstring''' import os from datetime import datetime as dt from github import Github __A =[ 'good first issue', 'good second issue', 'good difficult issue', 'enhancement', 'new pipeline/model', 'new scheduler', 'wip', ] def _Upper...
283
1
'''simple docstring''' import argparse import torch from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def _UpperCamelCase ( UpperCamelCase__ , UpperCame...
283
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, PegasusConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...
283
1
'''simple docstring''' from __future__ import annotations import math def _UpperCamelCase ( UpperCamelCase__ ): if num <= 0: UpperCAmelCase__ : List[Any] = f'''{num}: Invalid input, please enter a positive integer.''' raise ValueError...
283
'''simple docstring''' import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available...
283
1
'''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 __A =logging.get_logger(__name__) __A ...
283
'''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 __A =logging.get_logger(__name__) __A ...
283
1
'''simple docstring''' from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Sequence, Value from .base import TaskTemplate @dataclass(frozen=a__ ) class _snake_case ( a__ ): # `task` is not a ClassVar since we want it t...
283
'''simple docstring''' from dataclasses import dataclass from typing import 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 .modeling_utils import ModelMixin from ....
283
1
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ = 1_0 , UpperCamelCase__ = 2_2 ): UpperCAmelCase__ : List[str] = range(1 , UpperCamelCase__ ) UpperCAmelCase__ : int = range(1 , UpperCamelCase__ ) return sum( 1 fo...
283
'''simple docstring''' import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext...
283
1
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ , UpperCamelCase__ ): UpperCAmelCase__ : List[str] = """""" for i in table: res += inp[i - 1] return res def _UpperCamelCase ( UpperCamelCase__ ): return data[...
283
'''simple docstring''' import colorsys from PIL import Image # type: ignore def _UpperCamelCase ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ ): UpperCAmelCase__ : Optional[Any] = x UpperCAmelCase__ : Optional[int] = ...
283
1
'''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, PreTrainedTokenizer from ...utils import logging __A =logging.get_logger(__name__) __A ={'vocab_file'...
283
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A ={ 'configuration_table_transformer': [ 'TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TableTransformerConfig', 'Tab...
283
1
'''simple docstring''' import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient __A =WebClient(token=os.environ['CI_SLACK_BOT_TOKEN']) def _UpperCamelC...
283
'''simple docstring''' import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class _snake_case ( a__ ): lowerCAmelCase :Optional[int] = '''''' lowerCAmelCase :str ...
283
1
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licens...
283
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ ): UpperCAmelCase__ : List[str] = len(UpperCamelCase__ ) UpperCAmelCase__ : List[Any] = sum(UpperCamelCase__ ) UpperCAmelCase__ : List[str] = [[Fals...
283
1
'''simple docstring''' import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import SegformerImageProcessor, SwinConfig, UperNetConfig, UperNetForSemanticSegmentation def _UpperCamelCase ( ...
283
'''simple docstring''' import functools def _UpperCamelCase ( UpperCamelCase__ , UpperCamelCase__ ): # Validation if not isinstance(UpperCamelCase__ , UpperCamelCase__ ) or not all(isinstance(UpperCamelCase__ , UpperCamelCase__ ) for day in days ): raise V...
283
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __A ={} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass ...
283
'''simple docstring''' import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, i...
283
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class _snake_case ( metaclass=a__ ): lowerCAmelCase :Optional[Any] = ['''torch'''] def __init__( self , *_lowerCamelCase , **_lowerCamelCase): requires_b...
283
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ = 1_0 , UpperCamelCase__ = 2_2 ): UpperCAmelCase__ : List[str] = range(1 , UpperCamelCase__ ) UpperCAmelCase__ : int = range(1 , UpperCamelCase__ ) return sum( 1 fo...
283
1
'''simple docstring''' from dataclasses import dataclass from typing import 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 .modeling_utils import ModelMixin from ....
283
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __A ={ 'configuration_m2m_100': ['M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP', 'M2M100Config', 'M2M100OnnxConfig'], 'tokenizati...
283
1
'''simple docstring''' from ....configuration_utils import PretrainedConfig from ....utils import logging __A =logging.get_logger(__name__) __A ={ 'Visual-Attention-Network/van-base': ( 'https://huggingface.co/Visual-Attention-Network/van-base/blob/main/config.json' ), } ...
283
'''simple docstring''' import os import unicodedata 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 SPIECE_UNDERLINE, logging __A =logging.get_l...
283
1
'''simple docstring''' import argparse import copy def _UpperCamelCase ( UpperCamelCase__ ): UpperCAmelCase__ : Dict = {} with open(UpperCamelCase__ ) as f: for line in f: if line.split()[0] not in dict_of_neighbours: ...
283
'''simple docstring''' from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _snake_case ( ...
283
1
'''simple docstring''' import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class _snake_case ( unittest.TestCase ): def snake_case__ ( self): UpperCAmelCase__ : ...
283
'''simple docstring''' import numpy class _snake_case : def __init__( self , _lowerCamelCase , _lowerCamelCase): UpperCAmelCase__ : Dict = input_array # Random initial weights are assigned where first argument is t...
283
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_dpt import DPTImageProcessor __A =logging.get_logger(__name__) class _snake_case ( a__ ): def __init__( self , *_lowerCamelCase , **_lowerCamelCase)...
283
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transfo...
283
1
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING __A =logging.get_logger(__name__) class _snake_case ( a__ ): lowerCAmelCase :Optional[int] = '...
283
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import tensorflow as tf from transformers import Au...
283
1
'''simple docstring''' from __future__ import annotations def _UpperCamelCase ( UpperCamelCase__ ): UpperCAmelCase__ : Dict = str(UpperCamelCase__ ) return n == n[::-1] def _UpperCamelCase ( UpperCamelCase__ = 1_0_0_0_0_0...
283
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ = 4_0_0_0_0_0_0 ): UpperCAmelCase__ : List[str] = [0, 1] UpperCAmelCase__ : Any = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib[i + 2] > n: ...
283
1
'''simple docstring''' import importlib.metadata import operator import re import sys from typing import Optional from packaging import version __A ={ '<': operator.lt, '<=': operator.le, '==': operator.eq, '!=': operator.ne, '>=': operator.ge, '>': operator.gt, ...
283
'''simple docstring''' import re import string from collections import Counter import sacrebleu import sacremoses from packaging import version import datasets __A ='\n@inproceedings{xu-etal-2016-optimizing,\n title = {Optimizing Statistical Machine Translation for Text Simplification},\...
283
1
'''simple docstring''' import re def _UpperCamelCase ( UpperCamelCase__ ): if len(re.findall("""[ATCG]""" , UpperCamelCase__ ) ) != len(UpperCamelCase__ ): raise ValueError("""Invalid Strand""" ) return dna.translate(dna.maketrans("""ATCG""" , """TAGC"...
283
'''simple docstring''' import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class _snake_case ( unittest.TestCase ): def snake_case__ ( self): UpperCAmelCase__ : ...
283
1
'''simple docstring''' import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def _UpperCamelCase ( UpperCamelCase__ ): UpperCAmelCase__ : Union[str, Any] = FileLock(str(tmpdir / """foo.lock""" ) ) Upper...
283
'''simple docstring''' import os from datetime import datetime as dt from github import Github __A =[ 'good first issue', 'good second issue', 'good difficult issue', 'enhancement', 'new pipeline/model', 'new scheduler', 'wip', ] def _Upper...
283
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, PegasusConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...
283
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, PegasusConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...
283
1
'''simple docstring''' from typing import List from .keymap import KEYMAP, get_character def _UpperCamelCase ( UpperCamelCase__ ): def decorator(UpperCamelCase__ ): UpperCAmelCase__ : Optional[Any] = getattr(UpperCamelCase__ , """handle_ke...
283
'''simple docstring''' import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available...
283
1
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_availabl...
283
'''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 __A =logging.get_logger(__name__) __A ...
283
1
'''simple docstring''' import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin __A =get_tests_dir('fixtures/test...
283
'''simple docstring''' from dataclasses import dataclass from typing import 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 .modeling_utils import ModelMixin from ....
283
1
'''simple docstring''' import unittest from transformers import BigBirdTokenizer, BigBirdTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common...
283
'''simple docstring''' import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext...
283
1
'''simple docstring''' import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class _snake_case ( a__ ): lowerCAmelCase :int = (UnCLIPScheduler,) def snake_case__ ( self , **_lowerCamelCase): ...
283
'''simple docstring''' import colorsys from PIL import Image # type: ignore def _UpperCamelCase ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ ): UpperCAmelCase__ : Optional[Any] = x UpperCAmelCase__ : Optional[int] = ...
283
1
'''simple docstring''' from __future__ import annotations import queue class _snake_case : def __init__( self , _lowerCamelCase): UpperCAmelCase__ : Union[str, Any] = data UpperCAmelCase__ : int = None ...
283
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A ={ 'configuration_table_transformer': [ 'TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TableTransformerConfig', 'Tab...
283
1
'''simple docstring''' import torch from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel class _snake_case ( a__ ): lowerCAmelCase :Union[str, Any] = '''M-CLIP''' def __init__( self , _lowerCamelCase=1024 , _lowe...
283
'''simple docstring''' import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class _snake_case ( a__ ): lowerCAmelCase :Optional[int] = '''''' lowerCAmelCase :str ...
283
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __A ={ 'configuration_ctrl': ['CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CTRLConfig'], 'tokenization_ctrl': ['CTRLTokenizer'], } t...
283
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ ): UpperCAmelCase__ : List[str] = len(UpperCamelCase__ ) UpperCAmelCase__ : List[Any] = sum(UpperCamelCase__ ) UpperCAmelCase__ : List[str] = [[Fals...
283
1
'''simple docstring''' import requests from bsa import BeautifulSoup def _UpperCamelCase ( UpperCamelCase__ = "AAPL" ): UpperCAmelCase__ : Optional[Any] = f'''https://in.finance.yahoo.com/quote/{symbol}?s={symbol}''' UpperCAmelCase__ : Option...
283
'''simple docstring''' import functools def _UpperCamelCase ( UpperCamelCase__ , UpperCamelCase__ ): # Validation if not isinstance(UpperCamelCase__ , UpperCamelCase__ ) or not all(isinstance(UpperCamelCase__ , UpperCamelCase__ ) for day in days ): raise V...
283
1
'''simple docstring''' # Lint as: python3 import os import re import urllib.parse from pathlib import Path from typing import Callable, List, Optional, Union from zipfile import ZipFile from ..utils.file_utils import cached_path, hf_github_url from ..utils.logging import get_logger from ..utils....
283
'''simple docstring''' import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, i...
283
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class _snake_case ( metaclass=a__ ): lowerCAmelCase :int = ['''flax'''] def __init__( self , *_lowerCamelCase , **_lowerCamelCase): requires_backends(sel...
283
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ = 1_0 , UpperCamelCase__ = 2_2 ): UpperCAmelCase__ : List[str] = range(1 , UpperCamelCase__ ) UpperCAmelCase__ : int = range(1 , UpperCamelCase__ ) return sum( 1 fo...
283
1
'''simple docstring''' import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available from . import BaseDiffusersCLICommand ...
283
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __A ={ 'configuration_m2m_100': ['M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP', 'M2M100Config', 'M2M100OnnxConfig'], 'tokenizati...
283
1
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import ...
283
'''simple docstring''' import os import unicodedata 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 SPIECE_UNDERLINE, logging __A =logging.get_l...
283
1
'''simple docstring''' import copy import os import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np import pyarrow as pa import pyarrow.parquet as pq import pytest from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, Ty...
283
'''simple docstring''' from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _snake_case ( ...
283
1
'''simple docstring''' from typing import List import numpy as np def _UpperCamelCase ( UpperCamelCase__ ): UpperCAmelCase__ : int = {key: len(UpperCamelCase__ ) for key, value in gen_kwargs.items() if isinstance(UpperCamelCase__ , UpperCamelCase__...
283
'''simple docstring''' import numpy class _snake_case : def __init__( self , _lowerCamelCase , _lowerCamelCase): UpperCAmelCase__ : Dict = input_array # Random initial weights are assigned where first argument is t...
283
1
'''simple docstring''' import numpy as np from cva import destroyAllWindows, imread, imshow, waitKey class _snake_case : def __init__( self , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase): if dst_width < 0 or dst_height < 0: ...
283
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transfo...
283
1
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ ): return "".join(chr(ord(UpperCamelCase__ ) - 3_2 ) if """a""" <= char <= """z""" else char for char in word ) if __name__ == "__main__": from doctest import testmod testmod()
283
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import tensorflow as tf from transformers import Au...
283
1
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ ): UpperCAmelCase__ , UpperCAmelCase__ : Dict = [], [] while len(UpperCamelCase__ ) > 1: UpperCAmelCase__ , UpperCAmelCase__ : Optional[Any] = min(UpperCamelCa...
283
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ = 4_0_0_0_0_0_0 ): UpperCAmelCase__ : List[str] = [0, 1] UpperCAmelCase__ : Any = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib[i + 2] > n: ...
283
1
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ ): UpperCAmelCase__ : List[str] = len(UpperCamelCase__ ) UpperCAmelCase__ : List[Any] = sum(UpperCamelCase__ ) UpperCAmelCase__ : List[str] = [[Fals...
283
'''simple docstring''' import re import string from collections import Counter import sacrebleu import sacremoses from packaging import version import datasets __A ='\n@inproceedings{xu-etal-2016-optimizing,\n title = {Optimizing Statistical Machine Translation for Text Simplification},\...
283
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __A =logging.get_logger(__name__) __A ={ 'google/switch-base-8': 'https://huggingface.co/google/switch-base-8/blob/main/config.json', } class _snake_case ( a__ ): ...
283
'''simple docstring''' import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class _snake_case ( unittest.TestCase ): def snake_case__ ( self): UpperCAmelCase__ : ...
283
1
'''simple docstring''' import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def _UpperCamelCase ( Upper...
283
'''simple docstring''' import os from datetime import datetime as dt from github import Github __A =[ 'good first issue', 'good second issue', 'good difficult issue', 'enhancement', 'new pipeline/model', 'new scheduler', 'wip', ] def _Upper...
283
1
'''simple docstring''' class _snake_case : def __init__( self , _lowerCamelCase): UpperCAmelCase__ : int = set_counts UpperCAmelCase__ : Optional[int] = max(_lowerCamelCase) UpperCAmelCase__ : Lis...
283
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, PegasusConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...
283
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __A ={ 'configuration_vision_encoder_decoder': ['VisionEncoderDecoderConfig', 'Vision...
283
'''simple docstring''' import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available...
283
1
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ ): if not isinstance(UpperCamelCase__ , UpperCamelCase__ ) or number < 0: raise ValueError("""Input must be a non-negative integer""" ) UpperCAmelCase__ : Dict = 0 while number: ...
283
'''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 __A =logging.get_logger(__name__) __A ...
283
1
'''simple docstring''' from math import sqrt import numpy as np from sympy import symbols # Coefficient # Speed of light (m/s) __A =2_99_79_24_58 # Symbols __A , __A , __A , __A =symbols('ct x y z') def _UpperCamelCase ( UpperCamelCase__ ): if velocity > c:...
283
'''simple docstring''' from dataclasses import dataclass from typing import 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 .modeling_utils import ModelMixin from ....
283
1
'''simple docstring''' import unittest from transformers import SPIECE_UNDERLINE, ReformerTokenizer, ReformerTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test...
283
'''simple docstring''' import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext...
283
1
'''simple docstring''' import argparse import gc import json import os import shutil import warnings import torch from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer try: from transformers import LlamaTokenizerFast except ImportError as e: warnings.warn(e) warni...
283
'''simple docstring''' import colorsys from PIL import Image # type: ignore def _UpperCamelCase ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ ): UpperCAmelCase__ : Optional[Any] = x UpperCAmelCase__ : Optional[int] = ...
283
1
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow if is_torch_available(): import torch from transformers import XLMRobertaModel @require_sentencepiec...
283
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A ={ 'configuration_table_transformer': [ 'TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TableTransformerConfig', 'Tab...
283
1
'''simple docstring''' import unittest from transformers import DebertaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common im...
283
'''simple docstring''' import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class _snake_case ( a__ ): lowerCAmelCase :Optional[int] = '''''' lowerCAmelCase :str ...
283
1
'''simple docstring''' from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class _snake_case ( yaml.SafeLoader ): def snake_case__ ( self , _lowerCamelCase): UpperCAmelCase__ : str ...
283
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ ): UpperCAmelCase__ : List[str] = len(UpperCamelCase__ ) UpperCAmelCase__ : List[Any] = sum(UpperCamelCase__ ) UpperCAmelCase__ : List[str] = [[Fals...
283
1
'''simple docstring''' import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def _UpperCamelCase ( Up...
283
'''simple docstring''' import functools def _UpperCamelCase ( UpperCamelCase__ , UpperCamelCase__ ): # Validation if not isinstance(UpperCamelCase__ , UpperCamelCase__ ) or not all(isinstance(UpperCamelCase__ , UpperCamelCase__ ) for day in days ): raise V...
283
1
'''simple docstring''' import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class _snake_case ( a__ ): lowerCAmelCase :Optional[int] = '''''' lowerCAmelCase :str ...
283
'''simple docstring''' import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, i...
283
1
'''simple docstring''' import math import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from .attention_processor import Attention from .embeddings import get_timestep_embedding from .modeling_utils import ModelMixin class _snake_case ( ...
283
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ = 1_0 , UpperCamelCase__ = 2_2 ): UpperCAmelCase__ : List[str] = range(1 , UpperCamelCase__ ) UpperCAmelCase__ : int = range(1 , UpperCamelCase__ ) return sum( 1 fo...
283
1
'''simple docstring''' import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific no...
283
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __A ={ 'configuration_m2m_100': ['M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP', 'M2M100Config', 'M2M100OnnxConfig'], 'tokenizati...
283
1
'''simple docstring''' import math from typing import Callable, List, Optional, Union import numpy as np import PIL import torch from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines....
283
'''simple docstring''' import os import unicodedata 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 SPIECE_UNDERLINE, logging __A =logging.get_l...
283
1
'''simple docstring''' from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, Inpu...
283
'''simple docstring''' from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _snake_case ( ...
283
1
'''simple docstring''' from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...models ...
283
'''simple docstring''' import numpy class _snake_case : def __init__( self , _lowerCamelCase , _lowerCamelCase): UpperCAmelCase__ : Dict = input_array # Random initial weights are assigned where first argument is t...
283
1
'''simple docstring''' import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def _UpperCamelCase ( UpperCamelCase__ ): UpperCAmelCase__ : List[Any] = ...
283
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transfo...
283
1
'''simple docstring''' import numpy class _snake_case : def __init__( self , _lowerCamelCase , _lowerCamelCase): UpperCAmelCase__ : Dict = input_array # Random initial weights are assigned where first argument is t...
283
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import tensorflow as tf from transformers import Au...
283
1
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ = 4_0_0_0_0_0_0 ): UpperCAmelCase__ : List[str] = [0, 1] UpperCAmelCase__ : Any = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib[i + 2] > n: ...
283
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ = 4_0_0_0_0_0_0 ): UpperCAmelCase__ : List[str] = [0, 1] UpperCAmelCase__ : Any = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib[i + 2] > n: ...
283
1
'''simple docstring''' import warnings from functools import wraps from typing import Callable def _UpperCamelCase ( UpperCamelCase__ ): @wraps(UpperCamelCase__ ) def _inner_fn(*UpperCamelCase__ , **UpperCamelCase__ ): warnings.warn( (f'''\'{fn....
283
'''simple docstring''' import re import string from collections import Counter import sacrebleu import sacremoses from packaging import version import datasets __A ='\n@inproceedings{xu-etal-2016-optimizing,\n title = {Optimizing Statistical Machine Translation for Text Simplification},\...
283
1
'''simple docstring''' import argparse import os import re import packaging.version __A ='examples/' __A ={ 'examples': (re.compile(R'^check_min_version\("[^"]+"\)\s*$', re.MULTILINE), 'check_min_version("VERSION")\n'), 'init': (re.compile(R'^__version__\s+=\s+"([^"]+)"\s*$', re.MULT...
283
'''simple docstring''' import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class _snake_case ( unittest.TestCase ): def snake_case__ ( self): UpperCAmelCase__ : ...
283
1
'''simple docstring''' import colorsys from PIL import Image # type: ignore def _UpperCamelCase ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ ): UpperCAmelCase__ : Optional[Any] = x UpperCAmelCase__ : Optional[int] = ...
283
'''simple docstring''' import os from datetime import datetime as dt from github import Github __A =[ 'good first issue', 'good second issue', 'good difficult issue', 'enhancement', 'new pipeline/model', 'new scheduler', 'wip', ] def _Upper...
283
1
'''simple docstring''' import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, i...
283
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, PegasusConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...
283
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_com...
283
'''simple docstring''' import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available...
283
1
'''simple docstring''' import argparse import os import gluonnlp as nlp import mxnet as mx import numpy as np import torch from gluonnlp.base import get_home_dir from gluonnlp.model.bert import BERTEncoder from gluonnlp.model.utils import _load_vocab from gluonnlp.vocab import Vocab from packag...
283
'''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 __A =logging.get_logger(__name__) __A ...
283
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule __A ={'tokenization_bertweet': ['BertweetTokenizer']} if TYPE_CHECKING: from .tokenization_bertweet import BertweetTokenizer else: import sys __A =_LazyModule(__name__, globals()['__file__'...
283
'''simple docstring''' from dataclasses import dataclass from typing import 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 .modeling_utils import ModelMixin from ....
283
1
'''simple docstring''' # DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_confi...
283
'''simple docstring''' import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext...
283
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import tensorflow as tf from transformers import Au...
283
'''simple docstring''' import colorsys from PIL import Image # type: ignore def _UpperCamelCase ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ ): UpperCAmelCase__ : Optional[Any] = x UpperCAmelCase__ : Optional[int] = ...
283
1
'''simple docstring''' import os import re import unicodedata from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import is_torch_available, logging ...
283
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A ={ 'configuration_table_transformer': [ 'TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TableTransformerConfig', 'Tab...
283
1