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 unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFAutoModel, is_tensorflow_text_available, is_tf_available from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.testing_utils import require_tensorflow_text, requir...
81
'''simple docstring''' import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAna...
75
0
"""simple docstring""" def a__ ( lowerCAmelCase__ = 50 ): UpperCAmelCase_ = [1] * (length + 1) for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - tile_length + 1 ): ...
82
'''simple docstring''' import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets UpperCamelCase__ = '''\ @article{hendrycksmath2021, title={Measuring Mathematical Problem Solving With the MATH Dataset}, author={Dan Hendrycks and Collin Burns and Saura...
75
0
"""simple docstring""" import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStr...
83
'''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_b...
75
0
UpperCAmelCase = ''' # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git ''' UpperCAmelCase = [{'''type''...
84
'''simple docstring''' import random from typing import Any def a__ ( lowerCAmelCase__ ) -> list[Any]: for _ in range(len(lowerCAmelCase__ ) ): UpperCAmelCase__ : int = random.randint(0 , len(lowerCAmelCase__ ) - 1 ) UpperCAmelCas...
75
0
from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging SCREAMING_SNAKE_CASE__ : int = logging.get_logger(__name__) def _a ( lowercase__ : Union[tf.Tensor, np.ndarray] ): '''simple docstring''' ...
85
'''simple docstring''' import math def a__ ( lowerCAmelCase__ ) -> list[int]: UpperCAmelCase__ : List[Any] = [] UpperCAmelCase__ : Dict = 2 UpperCAmelCase__ : Optional[Any] = int(math.sqrt(lowerCAmelCase__ )...
75
0
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename __a :str = 'http://www.mocksite.com/file1.txt' ...
86
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, PNDMScheduler, StableDiffusionInpaintPipeline, UNetaDConditionModel from diff...
75
0
import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def SCREAMING_SNAKE_CASE ( lowercase_ ) -> List[str]: """simple docstring""" def wrapper(*lowercase_ , **lowercase_ ): ...
87
'''simple docstring''' import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...tes...
75
0
"""simple docstring""" import functools def _snake_case ( __snake_case : str , __snake_case : str ): """simple docstring""" _lowerCamelCase : int = len(__snake_case ) _lowerCamelCase : List[Any] = len(__snake_case ) ...
88
'''simple docstring''' import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class lowerCamelCase_ ( datasets.BeamBasedBuilder ): ...
75
0
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 DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from transformers.utils import logging logging.set...
89
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
75
0
'''simple docstring''' import unittest from transformers import BertGenerationTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin ...
90
'''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 a__ ( lowerCAmelCase__ , lowerCAmelCase__ , lowerC...
75
0
"""simple docstring""" from math import sqrt def _snake_case ( snake_case__ : int ): A = 0 for i in range(1 , int(sqrt(snake_case__ ) + 1 ) ): if n % i == 0 and i != sqrt(snake_case__ ): total += i + n // i elif i == sqrt(snake_case__ ): total += i return total - n ...
91
'''simple docstring''' from __future__ import annotations import copy import inspect import unittest import numpy as np from transformers import is_tf_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from transfor...
75
0
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, Wava...
92
'''simple docstring''' import webbrowser from sys import argv from urllib.parse import parse_qs, quote import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": UpperCamelCase__ = '''%20'''.join(argv[1:]) if len(argv) > 1 else quote(str(in...
75
0
"""simple docstring""" from __future__ import annotations def __A (_SCREAMING_SNAKE_CASE ) ->float: """simple docstring""" if not nums: raise ValueError('List is empty' ) return sum(_SCREAMING_SNAKE_CASE ) / len(_SCREAMING_SNAKE_CASE ) if __name__ == "__main__": i...
93
'''simple docstring''' from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def a__ ( lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ ) -> np.ndarray: UpperCAmelCase__ ...
75
0
'''simple docstring''' def lowercase_ ( __A : Tuple ) -> Tuple: """simple docstring""" lowercase : int =len(__A ) lowercase : int =sum(__A ) lowercase : List[Any] =[[False for x in range(s + 1 )] for y in range(n + 1 ...
94
'''simple docstring''' from datetime import datetime as dt import os from github import Github UpperCamelCase__ = [ '''good first issue''', '''good second issue''', '''good difficult issue''', '''feature request''', '''new model''', '''wip''', ] def ...
75
0
"""simple docstring""" import re def snake_case ( A__ ): UpperCAmelCase_ : Optional[int] = re.compile(r"^(\+91[\-\s]?)?[0]?(91)?[789]\d{9}$" ) if match := re.search(A__ ,A__ ): return match.string == phone return False if __name__ == "__main__": print(indian_phone_...
95
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline UpperCamelCase__ = logging.get_logger(__name__) # pylint: disable=invalid-name class ...
75
0
"""simple docstring""" from __future__ import annotations import requests __lowerCamelCase = set( 'approved_at_utc approved_by author_flair_background_color\nauthor_flair_css_class author_flair_richtext author_flair_template_id author_fullname\nauthor_premium can_mod_post cate...
96
'''simple docstring''' from math import factorial def a__ ( lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ ) -> float: if successes > trials: raise ValueError('''successes must be lower or equal to trials''' ) if trials < 0 or successes < 0: ...
75
0
import io import itertools import json from dataclasses import dataclass from typing import Optional import pyarrow as pa import pyarrow.json as paj import datasets from datasets.table import table_cast from datasets.utils.file_utils import readline __a = datasets.utils.logging.get_logger(...
97
'''simple docstring''' from typing import Dict, Iterable, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, ...
75
0
'''simple docstring''' import warnings from ...utils import logging from .image_processing_segformer import SegformerImageProcessor lowercase__ : Union[str, Any] = logging.get_logger(__name__) class __lowerCAmelCase ( __magic_name__ ): """simple docstring""" ...
98
'''simple docstring''' import math def a__ ( ) -> None: UpperCAmelCase__ : List[str] = input('''Enter message: ''' ) UpperCAmelCase__ : Any = int(input(F"""Enter key [2-{len(lowerCAmelCase__ ) - 1}]: """ ) ) UpperCAmelCase__ ...
75
0
import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor SCREAMING_SNAKE_CASE = logging.getLogger(__name__) SCREAMING_SNAKE_CASE ...
99
'''simple docstring''' class lowerCamelCase_ : def __init__( self : str , _A : Union[str, Any] , _A : Optional[int] ): '''simple docstring''' UpperCAmelCase__ : Optional[Any] = name ...
75
0
import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( FlaxForcedBOSToken...
100
'''simple docstring''' import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py UpperCamelCase__ = '''src/transformers'...
75
0
import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transformers.utils i...
101
'''simple docstring''' from ..utils import DummyObject, requires_backends class lowerCamelCase_ ( metaclass=__a ): lowerCAmelCase__ = ['torch', 'torchsde'] def __init__( self : Tuple , *_A : Any , **_A : Optional[Any] ...
75
0
"""simple docstring""" import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def ...
102
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ = logging.get_logger(__name__) UpperCamelCase__ = {'''ctrl''': '''https://huggingface.co/ctrl/resolve/main/config.json'''} class lowerCamelCase_ ( ...
75
0
"""simple docstring""" from .glue import GlueDataset, GlueDataTrainingArguments from .language_modeling import ( LineByLineTextDataset, LineByLineWithRefDataset, LineByLineWithSOPTextDataset, TextDataset, TextDatasetForNextSentencePrediction, ) from .squad import SquadDa...
103
'''simple docstring''' import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAna...
75
0
"""simple docstring""" import json import os import unittest from typing import Tuple from transformers import WavaVecaPhonemeCTCTokenizer from transformers.models.wavaveca.tokenization_wavaveca import VOCAB_FILES_NAMES from transformers.models.wavaveca_phoneme.tokenization_wavaveca_phone...
104
'''simple docstring''' import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets UpperCamelCase__ = '''\ @article{hendrycksmath2021, title={Measuring Mathematical Problem Solving With the MATH Dataset}, author={Dan Hendrycks and Collin Burns and Saura...
75
0
import collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_flax_available, is_torch_available, is_vision_availabl...
105
'''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_b...
75
0
from collections.abc import Sequence def lowerCamelCase_ ( lowerCAmelCase__ : Sequence[int] | None = None ) -> int: '''simple docstring''' if nums is None or not nums: raise ValueError('Input sequence should not be empty' ) A = n...
106
'''simple docstring''' import random from typing import Any def a__ ( lowerCAmelCase__ ) -> list[Any]: for _ in range(len(lowerCAmelCase__ ) ): UpperCAmelCase__ : int = random.randint(0 , len(lowerCAmelCase__ ) - 1 ) UpperCAmelCas...
75
0
'''simple docstring''' import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) _UpperCAmelCase : List[str] = pytest.mark.integration @pytes...
107
'''simple docstring''' import math def a__ ( lowerCAmelCase__ ) -> list[int]: UpperCAmelCase__ : List[Any] = [] UpperCAmelCase__ : Dict = 2 UpperCAmelCase__ : Optional[Any] = int(math.sqrt(lowerCAmelCase__ )...
75
0
import inspect import unittest from transformers import MobileViTConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ......
108
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, PNDMScheduler, StableDiffusionInpaintPipeline, UNetaDConditionModel from diff...
75
0
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional from packaging import version if TYPE_CHECKING: from ... import PreTrainedTokenizer, TensorType from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithP...
109
'''simple docstring''' import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...tes...
75
0
"""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_common import TFMode...
110
'''simple docstring''' import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class lowerCamelCase_ ( datasets.BeamBasedBuilder ): ...
75
0
'''simple docstring''' import sys from collections.abc import Mapping from typing import TYPE_CHECKING import numpy as np import pyarrow as pa from .. import config from ..utils.py_utils import map_nested from .formatting import TensorFormatter if TYPE_CHECKING: import torch class __lowerCAmelCas...
665
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
75
0
from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class lowercase_ ( __a ): ...
443
'''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 a__ ( lowerCAmelCase__ , lowerCAmelCase__ , lowerC...
75
0
from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging...
99
'''simple docstring''' from __future__ import annotations import copy import inspect import unittest import numpy as np from transformers import is_tf_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from transfor...
75
0
'''simple docstring''' from ....configuration_utils import PretrainedConfig from ....utils import logging lowercase = logging.get_logger(__name__) lowercase = { '''CarlCochet/trajectory-transformer-halfcheetah-medium-v2''': ( '''https://huggingface.co/CarlCochet/trajector...
211
'''simple docstring''' import webbrowser from sys import argv from urllib.parse import parse_qs, quote import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": UpperCamelCase__ = '''%20'''.join(argv[1:]) if len(argv) > 1 else quote(str(in...
75
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCamelCase = logging.get_logger(__name__) _UpperCamelCase = { '''google/switch-base-8''': '''https://huggingface.co/google/switch-base-8/blob/main/config.json''', } class _lowerCamelCase ( _...
243
'''simple docstring''' from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def a__ ( lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ ) -> np.ndarray: UpperCAmelCase__ ...
75
0
"""simple docstring""" from math import pi def lowercase_ ( _lowerCamelCase: List[Any] , _lowerCamelCase: Any ) -> float: '''simple docstring''' return 2 * pi * radius * (angle / 360) if __name__ == "__main__": print(arc_length(90, 10))
646
'''simple docstring''' from datetime import datetime as dt import os from github import Github UpperCamelCase__ = [ '''good first issue''', '''good second issue''', '''good difficult issue''', '''feature request''', '''new model''', '''wip''', ] def ...
75
0
'''simple docstring''' import json import sys def __UpperCAmelCase ( a_: str, a_: Optional[int] ): with open(lowerCAmelCase__, encoding="utf-8" ) as f: _UpperCAmelCase : Union[str, Any] = json.load(lowerCAmelCase__ ) _UpperCAmelCase : str = ['''...
494
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline UpperCamelCase__ = logging.get_logger(__name__) # pylint: disable=invalid-name class ...
75
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCAmelCase : int = { "configuration_megatron_bert": ["MEGATRON_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "MegatronBertConfig"], } try: if not is_tor...
289
'''simple docstring''' from math import factorial def a__ ( lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ ) -> float: if successes > trials: raise ValueError('''successes must be lower or equal to trials''' ) if trials < 0 or successes < 0: ...
75
0
"""simple docstring""" from datetime import datetime as dt import os from github import Github snake_case : List[Any] = [ """good first issue""", """good second issue""", """good difficult issue""", """feature request""", """new model""", """wip""", ] d...
545
'''simple docstring''' from typing import Dict, Iterable, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, ...
75
0
import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor UpperCamelCase = logging.get_logger(__name__) class __lowerCamelCase ( __a ): """simple docstring""" def __init__( self : Union[str, Any] , ...
61
'''simple docstring''' import math def a__ ( ) -> None: UpperCAmelCase__ : List[str] = input('''Enter message: ''' ) UpperCAmelCase__ : Any = int(input(F"""Enter key [2-{len(lowerCAmelCase__ ) - 1}]: """ ) ) UpperCAmelCase__ ...
75
0
'''simple docstring''' from collections.abc import Callable import numpy as np def __lowerCamelCase ( SCREAMING_SNAKE_CASE_ : Union[str, Any] , SCREAMING_SNAKE_CASE_ : List[Any] , SCREAMING_SNAKE_CASE_ : Dict , SCREAMING_SNAKE_CASE_ : Dict , SC...
421
'''simple docstring''' class lowerCamelCase_ : def __init__( self : str , _A : Union[str, Any] , _A : Optional[int] ): '''simple docstring''' UpperCAmelCase__ : Optional[Any] = name ...
75
0
'''simple docstring''' import numpy as np from nltk.translate import meteor_score import datasets from datasets.config import importlib_metadata, version __magic_name__ = version.parse(importlib_metadata.version('nltk')) if NLTK_VERSION >= version.Version('3.6.4'): from nltk import word_tokenize ...
665
'''simple docstring''' import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py UpperCamelCase__ = '''src/transformers'...
75
0
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.utils.testing_uti...
443
'''simple docstring''' from ..utils import DummyObject, requires_backends class lowerCamelCase_ ( metaclass=__a ): lowerCAmelCase__ = ['torch', 'torchsde'] def __init__( self : Tuple , *_A : Any , **_A : Optional[Any] ...
75
0
import inspect import unittest from transformers import YolosConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...
99
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ = logging.get_logger(__name__) UpperCamelCase__ = {'''ctrl''': '''https://huggingface.co/ctrl/resolve/main/config.json'''} class lowerCamelCase_ ( ...
75
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, PNDMScheduler, StableDiffusionInpaintPipeline, UNetaDConditionModel from di...
211
'''simple docstring''' import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAna...
75
0
from multiprocessing import Lock, Pipe, Process # lock used to ensure that two processes do not access a pipe at the same time _UpperCamelCase = Lock() def lowerCAmelCase__( lowercase : List[Any] , lowercase : Optional[Any] , lowercase : Tuple , lowercase ...
243
'''simple docstring''' import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets UpperCamelCase__ = '''\ @article{hendrycksmath2021, title={Measuring Mathematical Problem Solving With the MATH Dataset}, author={Dan Hendrycks and Collin Burns and Saura...
75
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) __A = {'''configuration_reformer''': ['''REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Re...
646
'''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_b...
75
0
'''simple docstring''' import functools from typing import Any def __UpperCAmelCase ( a_: int, a_: Tuple ): # Validation if not isinstance(lowerCAmelCase__, lowerCAmelCase__ ) or len(lowerCAmelCase__ ) == 0: raise ValueError("the string should be not empty string" )...
494
'''simple docstring''' import random from typing import Any def a__ ( lowerCAmelCase__ ) -> list[Any]: for _ in range(len(lowerCAmelCase__ ) ): UpperCAmelCase__ : int = random.randint(0 , len(lowerCAmelCase__ ) - 1 ) UpperCAmelCas...
75
0
"""simple docstring""" from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record _lowerCAmelCase : Optional[Any] = "\\n@article{wang2019superglue,\n title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Und...
289
'''simple docstring''' import math def a__ ( lowerCAmelCase__ ) -> list[int]: UpperCAmelCase__ : List[Any] = [] UpperCAmelCase__ : Dict = 2 UpperCAmelCase__ : Optional[Any] = int(math.sqrt(lowerCAmelCase__ )...
75
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case : List[Any] = logging.get_logger(__name__) ...
545
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, PNDMScheduler, StableDiffusionInpaintPipeline, UNetaDConditionModel from diff...
75
0
from ...configuration_utils import PretrainedConfig UpperCamelCase = { 'google/tapas-base-finetuned-sqa': ( 'https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json' ), 'google/tapas-base-finetuned-wtq': ( 'https://huggingface.co/google/tapa...
61
'''simple docstring''' import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...tes...
75
0
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normaliz...
421
'''simple docstring''' import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class lowerCamelCase_ ( datasets.BeamBasedBuilder ): ...
75
0
'''simple docstring''' from __future__ import annotations import numpy as np def lowerCamelCase ( lowerCamelCase : str): return np.maximum(0 , lowerCAmelCase__) if __name__ == "__main__": print(np.array(relu([-1, 0, 5]))) # --> [0, 0, 5]
665
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
75
0
import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class lowercase_ : def __init__( self , __A=2 , __A=3 , __A=64 , __A=None ) -> Optional[Any]: ...
443
'''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 a__ ( lowerCAmelCase__ , lowerCAmelCase__ , lowerC...
75
0
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transform...
99
'''simple docstring''' from __future__ import annotations import copy import inspect import unittest import numpy as np from transformers import is_tf_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from transfor...
75
0
'''simple docstring''' import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ...
211
'''simple docstring''' import webbrowser from sys import argv from urllib.parse import parse_qs, quote import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": UpperCamelCase__ = '''%20'''.join(argv[1:]) if len(argv) > 1 else quote(str(in...
75
0
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 from ..table import array_cast from .....
243
'''simple docstring''' from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def a__ ( lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ ) -> np.ndarray: UpperCAmelCase__ ...
75
0
"""simple docstring""" import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_sen...
646
'''simple docstring''' from datetime import datetime as dt import os from github import Github UpperCamelCase__ = [ '''good first issue''', '''good second issue''', '''good difficult issue''', '''feature request''', '''new model''', '''wip''', ] def ...
75
0
'''simple docstring''' import os import sys __a = os.path.join(os.path.dirname(__file__), 'src') sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, AutoModelForSequenceClassifica...
494
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline UpperCamelCase__ = logging.get_logger(__name__) # pylint: disable=invalid-name class ...
75
0
"""simple docstring""" import os import jsonlines import numpy as np from tqdm import tqdm _lowerCAmelCase : List[str] = 20_48 _lowerCAmelCase : Optional[Any] = 40_96 _lowerCAmelCase : Optional[int] = 42 _lowerCAmelCase : int = os.environ.pop("PROCESS_T...
289
'''simple docstring''' from math import factorial def a__ ( lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ ) -> float: if successes > trials: raise ValueError('''successes must be lower or equal to trials''' ) if trials < 0 or successes < 0: ...
75
0
"""simple docstring""" def A ( __snake_case: str = 1_0_0_0_0_0_0 ) -> int: """simple docstring""" __magic_name__ = 1 __magic_name__ = 1 __magic_name__ = {1: 1} for inputa in range(2 , lowerCA...
545
'''simple docstring''' from typing import Dict, Iterable, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, ...
75
0
import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py UpperCamelCase = 'src/transformers' # This is to make su...
61
'''simple docstring''' import math def a__ ( ) -> None: UpperCAmelCase__ : List[str] = input('''Enter message: ''' ) UpperCAmelCase__ : Any = int(input(F"""Enter key [2-{len(lowerCAmelCase__ ) - 1}]: """ ) ) UpperCAmelCase__ ...
75
0
'''simple docstring''' import importlib import torch import yaml from omegaconf import OmegaConf from taming.models.vqgan import VQModel def __lowerCamelCase ( SCREAMING_SNAKE_CASE_ : Dict , SCREAMING_SNAKE_CASE_ : Dict=False ) -> List[str]: """simple ...
421
'''simple docstring''' class lowerCamelCase_ : def __init__( self : str , _A : Union[str, Any] , _A : Optional[int] ): '''simple docstring''' UpperCAmelCase__ : Optional[Any] = name ...
75
0
'''simple docstring''' def lowerCamelCase ( lowerCamelCase : List[Any]): A_ : Optional[int] = [False] * len(lowerCAmelCase__) A_ : str = [-1] * len(lowerCAmelCase__) def dfs(lowerCamelCase : List[str] , lowerCamelCase : Union[str, Any]): ...
665
'''simple docstring''' import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py UpperCamelCase__ = '''src/transformers'...
75
0
import math def SCREAMING_SNAKE_CASE_ ( UpperCAmelCase_ : List[str] ) -> list[int]: SCREAMING_SNAKE_CASE_ : List[Any] =[] SCREAMING_SNAKE_CASE_ : Dict =2 SCREAMING_SNAKE_CASE_ : Optional[Any] =int(math.sqrt(lowerCAmelCase__ ) ) # S...
443
'''simple docstring''' from ..utils import DummyObject, requires_backends class lowerCamelCase_ ( metaclass=__a ): lowerCAmelCase__ = ['torch', 'torchsde'] def __init__( self : Tuple , *_A : Any , **_A : Optional[Any] ...
75
0
import functools import logging import os import sys import threading from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional import huggingface...
99
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ = logging.get_logger(__name__) UpperCamelCase__ = {'''ctrl''': '''https://huggingface.co/ctrl/resolve/main/config.json'''} class lowerCamelCase_ ( ...
75
0
'''simple docstring''' import argparse import os from accelerate.utils import ComputeEnvironment from .cluster import get_cluster_input from .config_args import cache_dir, default_config_file, default_yaml_config_file, load_config_from_file # noqa: F401 from .config_utils import _ask_field, _ask_opti...
211
'''simple docstring''' import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAna...
75
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCamelCase = logging.get_logger(__name__) class _lowerCamelCase ( __a ): """simple docstring""" UpperCAmelCase_ : Union[str, Any] ="timm_backbone" def __in...
243
'''simple docstring''' import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets UpperCamelCase__ = '''\ @article{hendrycksmath2021, title={Measuring Mathematical Problem Solving With the MATH Dataset}, author={Dan Hendrycks and Collin Burns and Saura...
75
0
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics fr...
646
'''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_b...
75
0
'''simple docstring''' __a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' def __UpperCAmelCase ( a_: Dict ): # Make sure the supplied data is a bytes-like object if not isinstance(lowerCAmelCase__, lowerCAmelCase__ ): _UpperCAmelCase : U...
494
'''simple docstring''' import random from typing import Any def a__ ( lowerCAmelCase__ ) -> list[Any]: for _ in range(len(lowerCAmelCase__ ) ): UpperCAmelCase__ : int = random.randint(0 , len(lowerCAmelCase__ ) - 1 ) UpperCAmelCas...
75
0
"""simple docstring""" from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class UpperCAmelCase_ ( yaml.SafeLoader ): def snake_case_ ( self : Optional[Any] , A : List[str] ): _UpperCAmelCase :...
289
'''simple docstring''' import math def a__ ( lowerCAmelCase__ ) -> list[int]: UpperCAmelCase__ : List[Any] = [] UpperCAmelCase__ : Dict = 2 UpperCAmelCase__ : Optional[Any] = int(math.sqrt(lowerCAmelCase__ )...
75
0
"""simple docstring""" import argparse import collections import os import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_table.py snake_case : Optiona...
545
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, PNDMScheduler, StableDiffusionInpaintPipeline, UNetaDConditionModel from diff...
75
0
from __future__ import annotations class __lowerCamelCase : """simple docstring""" def __init__( self : int , SCREAMING_SNAKE_CASE__ : list[list[int]] ) -> Union[str, Any]: lowerCAmelCase__ = TypeError( "Matrices must be f...
61
'''simple docstring''' import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...tes...
75
0
'''simple docstring''' from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class SCREAMING_SNAKE_CASE__ ( __a ): _A = ["image_processor", "tokenizer"] _A = "AutoImageProcessor" _A = ...
421
'''simple docstring''' import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class lowerCamelCase_ ( datasets.BeamBasedBuilder ): ...
75
0
'''simple docstring''' from __future__ import annotations from math import pi def lowerCamelCase ( lowerCamelCase : List[Any] , lowerCamelCase : str , lowerCamelCase : Any): if (inductance, frequency, reactance).count(0) != 1: raise ValueError("""One and only one...
665
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
75
0
def SCREAMING_SNAKE_CASE_ ( UpperCAmelCase_ : str , UpperCAmelCase_ : List[str] ) -> str: SCREAMING_SNAKE_CASE_ : list[list[str]] =[[] for _ in range(lowerCAmelCase__ )] SCREAMING_SNAKE_CASE_ : Union[str, Any] =key - 1 if key <= 0: ...
443
'''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 a__ ( lowerCAmelCase__ , lowerCAmelCase__ , lowerC...
75
0
import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets SCREAMING_SNAKE_CASE = '\\n@article{hendrycksmath2021,\n title={Measuring Mathematical Problem Solving With the MATH Dataset},\n author={Dan Hendrycks\n and Collin Burns\n and Saurav Kadavath...
99
'''simple docstring''' from __future__ import annotations import copy import inspect import unittest import numpy as np from transformers import is_tf_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from transfor...
75
0
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowercase = logging.get_logger(__name__) lowercase = { '''ut/deta''': '''https://huggingface.co/ut/deta/resolve/main/config.jso...
211
'''simple docstring''' import webbrowser from sys import argv from urllib.parse import parse_qs, quote import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": UpperCamelCase__ = '''%20'''.join(argv[1:]) if len(argv) > 1 else quote(str(in...
75
0
import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging _UpperCamelCase = logging.get_logger(__name__) def lowerCAmelCase__( lowercase : Any , lowercase ...
243
'''simple docstring''' from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def a__ ( lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ ) -> np.ndarray: UpperCAmelCase__ ...
75
0
"""simple docstring""" from collections import deque from math import floor from random import random from time import time class _snake_case : def __init__( self : Tuple ): __lowerCamelCase : Dict = {} def lowerCamelCase__ ( self : ...
646
'''simple docstring''' from datetime import datetime as dt import os from github import Github UpperCamelCase__ = [ '''good first issue''', '''good second issue''', '''good difficult issue''', '''feature request''', '''new model''', '''wip''', ] def ...
75
0
'''simple docstring''' import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class A__ ( __a ): """simple docstring""" UpperCamelCase_ : int = (DDPMScheduler,) def _lowerCAmelCase ( self : Opt...
494
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline UpperCamelCase__ = logging.get_logger(__name__) # pylint: disable=invalid-name class ...
75
0
"""simple docstring""" 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 U...
289
'''simple docstring''' from math import factorial def a__ ( lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ ) -> float: if successes > trials: raise ValueError('''successes must be lower or equal to trials''' ) if trials < 0 or successes < 0: ...
75
0
"""simple docstring""" def A ( __snake_case: str ) -> str: """simple docstring""" if collection == []: return [] # get some information about the collection __magic_name__ = len(lowerCAmelCase__ ) __magi...
545
'''simple docstring''' from typing import Dict, Iterable, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, ...
75
0
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = {'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/config.json'} class __lowerCamelCase ( __a ): ...
61
'''simple docstring''' import math def a__ ( ) -> None: UpperCAmelCase__ : List[str] = input('''Enter message: ''' ) UpperCAmelCase__ : Any = int(input(F"""Enter key [2-{len(lowerCAmelCase__ ) - 1}]: """ ) ) UpperCAmelCase__ ...
75
0
'''simple docstring''' import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency snake_case_ = { 'E': 1_2.7_0, 'T': 9.0_6, 'A': 8.1_7, 'O': 7.5_1, 'I': 6.9_7, 'N': 6.7_5, 'S': 6.3_3, 'H': 6.0_9, 'R': 5.9_9, 'D': 4.2_5...
421
'''simple docstring''' class lowerCamelCase_ : def __init__( self : str , _A : Union[str, Any] , _A : Optional[int] ): '''simple docstring''' UpperCAmelCase__ : Optional[Any] = name ...
75
0
'''simple docstring''' import unittest import numpy as np import torch from diffusers import ScoreSdeVePipeline, ScoreSdeVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __lowerCAmelCase ( ...
665
'''simple docstring''' import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py UpperCamelCase__ = '''src/transformers'...
75
0
from typing import Any def SCREAMING_SNAKE_CASE_ ( UpperCAmelCase_ : Dict , UpperCAmelCase_ : str , UpperCAmelCase_ : int , UpperCAmelCase_ : Optional[Any] , UpperCAmelCase_ : Dict , ) -> list: _validation( lowerCAmelCa...
443
'''simple docstring''' from ..utils import DummyObject, requires_backends class lowerCamelCase_ ( metaclass=__a ): lowerCAmelCase__ = ['torch', 'torchsde'] def __init__( self : Tuple , *_A : Any , **_A : Optional[Any] ...
75
0
import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def a (lowerCAmelCase__ ): __a = [ ...
99
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ = logging.get_logger(__name__) UpperCamelCase__ = {'''ctrl''': '''https://huggingface.co/ctrl/resolve/main/config.json'''} class lowerCamelCase_ ( ...
75
0
'''simple docstring''' from math import factorial def __A ( _SCREAMING_SNAKE_CASE : Optional[Any] , _SCREAMING_SNAKE_CASE : Any , _SCREAMING_SNAKE_CASE : Optional[Any] ): """simple docstring""" if successes > trials: ...
211
'''simple docstring''' import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAna...
75
0
import argparse import os import gluonnlp as nlp import mxnet as mx import numpy as np import torch from gluonnlp.base import get_home_dir from gluonnlp.model.bert import BERTEncoder from gluonnlp.model.utils import _load_vocab from gluonnlp.vocab import Vocab from packaging import version from torch import nn ...
243
'''simple docstring''' import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets UpperCamelCase__ = '''\ @article{hendrycksmath2021, title={Measuring Mathematical Problem Solving With the MATH Dataset}, author={Dan Hendrycks and Collin Burns and Saura...
75
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 import...
646
'''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_b...
75
0
'''simple docstring''' from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 __a = { # 1536-bit 5: { 'prime': int( ...
494
'''simple docstring''' import random from typing import Any def a__ ( lowerCAmelCase__ ) -> list[Any]: for _ in range(len(lowerCAmelCase__ ) ): UpperCAmelCase__ : int = random.randint(0 , len(lowerCAmelCase__ ) - 1 ) UpperCAmelCas...
75
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCAmelCase : Dict = { "configuration_timesformer": ["TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TimesformerConfig"], } try: if not is_torch_a...
289
'''simple docstring''' import math def a__ ( lowerCAmelCase__ ) -> list[int]: UpperCAmelCase__ : List[Any] = [] UpperCAmelCase__ : Dict = 2 UpperCAmelCase__ : Optional[Any] = int(math.sqrt(lowerCAmelCase__ )...
75
0
"""simple docstring""" import collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_flax_av...
545
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, PNDMScheduler, StableDiffusionInpaintPipeline, UNetaDConditionModel from diff...
75
0
from typing import Dict, Iterable, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format, to_pil_image from ...image_utils import ( IMAGENET_S...
61
'''simple docstring''' import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...tes...
75
0
'''simple docstring''' from itertools import product def __lowerCamelCase ( SCREAMING_SNAKE_CASE_ : str , SCREAMING_SNAKE_CASE_ : Dict ) -> list[int]: """simple docstring""" SCREAMING_SNAKE_CASE_ : Optional[Any] = sides_number SCREAMING...
421
'''simple docstring''' import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class lowerCamelCase_ ( datasets.BeamBasedBuilder ): ...
75
0
'''simple docstring''' import re from ..models.auto import AutoProcessor from ..models.vision_encoder_decoder import VisionEncoderDecoderModel from ..utils import is_vision_available from .base import PipelineTool if is_vision_available(): from PIL import Image class __lowerCAmelCase ( __a ...
665
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
75
0
import warnings from ...utils import logging from .image_processing_segformer import SegformerImageProcessor _lowercase = logging.get_logger(__name__) class lowercase_ ( __a ): def __init__( self , *__A , **__A ) -> Any: ...
443
'''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 a__ ( lowerCAmelCase__ , lowerCAmelCase__ , lowerC...
75
0
from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from ......
99
'''simple docstring''' from __future__ import annotations import copy import inspect import unittest import numpy as np from transformers import is_tf_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from transfor...
75
0
'''simple docstring''' from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffuse...
211
'''simple docstring''' import webbrowser from sys import argv from urllib.parse import parse_qs, quote import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": UpperCamelCase__ = '''%20'''.join(argv[1:]) if len(argv) > 1 else quote(str(in...
75
0