code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
def UpperCamelCase ( lowerCAmelCase__ = 100_0000 ): '''simple docstring''' lowercase = set(range(3 , lowerCAmelCase__ , 2 ) ) primes.add(2 ) for p in range(3 , lowerCAmelCase__ , 2 ): if p not in primes: continue primes.diff...
101
"""simple docstring""" from collections.abc import Sequence def _A ( UpperCamelCase_ : Sequence[float], UpperCamelCase_ : float) -> float: '''simple docstring''' return sum(c * (x**i) for i, c in enumerate(UpperCamelCase_)) def _A ( UpperCamelCase_ : S...
17
0
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_flax_available, is_torch_available, is_transformers_available, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable...
102
"""simple docstring""" import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class _lowerCAmelCase ( pl.LightningModule ): """simple docstring""" def __init__( self : Option...
17
0
from datetime import datetime as dt import os from github import Github A__ : List[str] = [ '''good first issue''', '''good second issue''', '''good difficult issue''', '''feature request''', '''new model''', '''wip''', ] def UpperCamelCase( ): lowerCAmelCase_ : ...
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, TrainingJobAnalytics fr...
17
0
'''simple docstring''' from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowercase_ (lowerCamelCase__ ): """simple docstring""" SCREAMING_SNAKE_CASE : List[str] = ['image_processor', 'tokenizer'] SCREAMING_SNAKE_CASE...
104
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
17
0
"""simple docstring""" import unittest from dataclasses import dataclass import pytest from accelerate.commands.config.config_args import SageMakerConfig from accelerate.utils import ComputeEnvironment from accelerate.utils.launch import _convert_nargs_to_dict @dataclass class ...
105
"""simple docstring""" import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( Autoenco...
17
0
"""simple docstring""" from typing import List, Optional, TypeVar from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets from .dataset_dict import DatasetDict, IterableDatasetDict from .info import DatasetInfo from .iterable_dataset import IterableDataset, _concatena...
106
"""simple docstring""" from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin,...
17
0
from __future__ import annotations from scipy.special import comb # type: ignore class snake_case__ : """simple docstring""" def __init__( self : Any , __lowerCamelCase : list[tuple[float, float]] ) -> Tuple: a = list_of_points ...
107
"""simple docstring""" import time from contextlib import contextmanager from pathlib import Path import pytest import requests from huggingface_hub.hf_api import HfApi, HfFolder _a = '__DUMMY_TRANSFORMERS_USER__' _a = 'Dummy User' _a = 'hf_hZEmnoOEYISjraJtbySaKCNnSuYAvukaT...
17
0
"""simple docstring""" from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging ...
108
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { 'huggingface/time-series-transformer-tourism-monthly': ( 'https://huggingface.co/huggin...
17
0
"""simple docstring""" A: Dict = 8.314_4598 def _snake_case ( UpperCamelCase : float , UpperCamelCase : float ): if temperature < 0: raise Exception("""Temperature cannot be less than 0 K""" ) if molar_mass <= 0: raise Exception("""Molar mass cannot be less ...
109
"""simple docstring""" import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import ( ...
17
0
def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = generate_pascal_triangle(SCREAMING_SNAKE_CASE ) for row_idx in range(SCREAMING_SNAKE_CASE ): # Print left spaces for _ in range(num_rows - row_idx - 1 ): print(end=''...
110
"""simple docstring""" import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE from tra...
17
0
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoTokenizer, FlaxMTa...
26
"""simple docstring""" from __future__ import annotations from typing import Any class _lowerCAmelCase : """simple docstring""" def __init__( self : Any, UpperCAmelCase__ : int ): __lowercase = num_of_nodes __lowercase = [] __lo...
17
0
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowercase_ ( metaclass=__lowerCAmelCase ): '''simple docstring''' UpperCAmelCase : int = ["keras_nlp"] def __init__( self : str , *_UpperCAmelCase : Dict ...
315
"""simple docstring""" from math import sqrt def _A ( UpperCamelCase_ : int) -> int: '''simple docstring''' __lowercase = 0 for i in range(1, int(sqrt(UpperCamelCase_) + 1)): if n % i == 0 and i != sqrt(UpperCamelCase_): total += i + n // i eli...
17
0
from __future__ import annotations def SCREAMING_SNAKE_CASE_ ( snake_case__ ) -> float: if not nums: raise ValueError('''List is empty''' ) return sum(UpperCamelCase_ ) / len(UpperCamelCase_ ) if __name__ == "__main__": import doctest ...
338
"""simple docstring""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) _a = ...
17
0
'''simple docstring''' import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed ...
53
"""simple docstring""" import baseaa def _A ( UpperCamelCase_ : str) -> bytes: '''simple docstring''' return baseaa.baaencode(string.encode("utf-8")) def _A ( UpperCamelCase_ : bytes) -> str: '''simple docstring''' return baseaa.baadecode(UpperCamelCa...
17
0
class UpperCAmelCase : def __init__(self : int ) -> List[str]: '''simple docstring''' snake_case : Union[str, Any] = {} def _SCREAMING_SNAKE_CASE (self : Optional[Any] ) -> Dict: '''simple docstring''' ...
59
"""simple docstring""" def _A ( UpperCamelCase_ : Any) -> List[str]: '''simple docstring''' __lowercase ,__lowercase = [], [] while len(UpperCamelCase_) > 1: __lowercase ,__lowercase = min(UpperCamelCase_), max(UpperCamelCase_) start.append(Uppe...
17
0
from ..utils import DummyObject, requires_backends class __lowercase ( metaclass=UpperCAmelCase_ ): """simple docstring""" _UpperCAmelCase : Tuple = ["torch", "scipy"] def __init__( self : Any , *lowerCAmelCase__ : Optional[Any] , **lowerCAme...
13
"""simple docstring""" def _A ( UpperCamelCase_ : list[int]) -> float: '''simple docstring''' if not nums: # Makes sure that the list is not empty raise ValueError("List is empty") __lowercase = sum(UpperCamelCase_) / len(UpperCamelCase_) # Calculate the average...
17
0
import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datasets.table import table_cast fr...
71
"""simple docstring""" import inspect import unittest import numpy as np from transformers import BeitConfig from transformers.testing_utils import require_flax, require_vision, slow from transformers.utils import cached_property, is_flax_available, is_vision_available from ...test_configuration_common import...
17
0
'''simple docstring''' from abc import ABC, abstractmethod from typing import Optional, Union from .. import Dataset, DatasetDict, Features, IterableDataset, IterableDatasetDict, NamedSplit from ..utils.typing import NestedDataStructureLike, PathLike class _A ( __SCREAMING_SNAKE_CASE ): ...
254
"""simple docstring""" import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class _lowerCAmelCase ( unittest.TestCase ,lowercase ): """simple docstring""" def _lowercase ( self : List[Any] ): __lowercase = ...
17
0
'''simple docstring''' from collections.abc import Generator from math import sin def __lowerCamelCase ( _lowercase ) -> bytes: if len(UpperCamelCase_ ) != 3_2: raise ValueError("""Input must be of length 32""" ) UpperCAmelCase : List[Any] =...
265
"""simple docstring""" from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, Stabl...
17
0
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except Opti...
221
"""simple docstring""" import random import unittest import numpy as np import torch from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionUpscalePipeline, PNDMScheduler, ) from diffusers.ut...
17
0
from collections.abc import Callable from math import pi, sqrt from random import uniform from statistics import mean def lowerCAmelCase__( lowercase : int ) -> Optional[int]: def is_in_circle(lowercase : float , lowercase : float ) -> bool: __snake_case : U...
326
"""simple docstring""" import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datasets.table import table_ca...
17
0
import math import time from typing import Dict, List, Optional from torch.utils.data import Dataset from transformers import SeqaSeqTrainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_xla.core.xla_...
26
"""simple docstring""" from scipy.stats import spearmanr import datasets _a = '\nThe Spearman rank-order correlation coefficient is a measure of the\nrelationship between two datasets. Like other correlation coefficients,\nthis one varies between -1 and +1 with 0 implying no correlation.\nPositive...
17
0
"""simple docstring""" a = { 0: '''0''', 1: '''1''', 2: '''2''', 3: '''3''', 4: '''4''', 5: '''5''', 6: '''6''', 7: '''7''', 8: '''8''', 9: '''9''', 10: '''a''', 11: '''b''', 12: '''c''', 13: '''d''', 14: '''e''', 15: '''f''', } def ...
315
"""simple docstring""" from collections.abc import Sequence def _A ( UpperCamelCase_ : Sequence[float], UpperCamelCase_ : float) -> float: '''simple docstring''' return sum(c * (x**i) for i, c in enumerate(UpperCamelCase_)) def _A ( UpperCamelCase_ : S...
17
0
lowercase__ : Dict = '''\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n''' lowercase__ : Optional[Any]...
338
"""simple docstring""" import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class _lowerCAmelCase ( pl.LightningModule ): """simple docstring""" def __init__( self : Option...
17
0
'''simple docstring''' from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar a__ : Dict =TypeVar('''T''') class snake_case ( Generic[T] ): """simple docstring""" def __init__( self : Any , __A : ...
53
"""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...
17
0
import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import version from .....
59
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
17
0
from numpy import exp, pi, sqrt def A_ ( _UpperCAmelCase , _UpperCAmelCase = 0.0 , _UpperCAmelCase = 1.0 ): return 1 / sqrt(2 * pi * sigma**2 ) * exp(-((x - mu) ** 2) / (2 * sigma**2) ) if __name__ == "__main__": import doctest doctest.testmod()
13
"""simple docstring""" import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( Autoenco...
17
0
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, ...
71
"""simple docstring""" from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin,...
17
0
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import Au...
254
"""simple docstring""" import time from contextlib import contextmanager from pathlib import Path import pytest import requests from huggingface_hub.hf_api import HfApi, HfFolder _a = '__DUMMY_TRANSFORMERS_USER__' _a = 'Dummy User' _a = 'hf_hZEmnoOEYISjraJtbySaKCNnSuYAvukaT...
17
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging a : Tuple = logging.get_logger(__name__) a : List[str] = { """facebook/nllb-moe-54B""": """https://huggingface.co/facebook/nllb-moe-54b/resolve/main/config.json""", } class ...
265
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { 'huggingface/time-series-transformer-tourism-monthly': ( 'https://huggingface.co/huggin...
17
0
"""simple docstring""" from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): ...
221
"""simple docstring""" import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import ( ...
17
0
import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def lowerCAmelCase__( *lowercase : List[Any] ) -> List[str]: if not isinstance(UpperCamelCase_ , UpperCamelCase_ ): __snake_case : Dict = list(Uppe...
326
"""simple docstring""" import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE from tra...
17
0
import unittest import numpy as np def lowerCAmelCase_ ( snake_case_,snake_case_,snake_case_,snake_case_ = None,): _A : Tuple = np.shape(UpperCamelCase_ ) _A : List[Any] = np.shape(UpperCamelCase_ ) _A : int = np.shape(Upp...
26
"""simple docstring""" from __future__ import annotations from typing import Any class _lowerCAmelCase : """simple docstring""" def __init__( self : Any, UpperCAmelCase__ : int ): __lowercase = num_of_nodes __lowercase = [] __lo...
17
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 @requi...
315
"""simple docstring""" from math import sqrt def _A ( UpperCamelCase_ : int) -> int: '''simple docstring''' __lowercase = 0 for i in range(1, int(sqrt(UpperCamelCase_) + 1)): if n % i == 0 and i != sqrt(UpperCamelCase_): total += i + n // i eli...
17
0
import pickle import numpy as np from matplotlib import pyplot as plt class lowercase_ : """simple docstring""" def __init__( self , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , _...
338
"""simple docstring""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) _a = ...
17
0
'''simple docstring''' import argparse from collections import OrderedDict from pathlib import Path import requests import torch from PIL import Image from transformers import GLPNConfig, GLPNForDepthEstimation, GLPNImageProcessor from transformers.utils import logging logging.set_verbosity_info() a__ :...
53
"""simple docstring""" import baseaa def _A ( UpperCamelCase_ : str) -> bytes: '''simple docstring''' return baseaa.baaencode(string.encode("utf-8")) def _A ( UpperCamelCase_ : bytes) -> str: '''simple docstring''' return baseaa.baadecode(UpperCamelCa...
17
0
import argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basicConfig(level=logging.INFO) __lowerCamelCase ...
59
"""simple docstring""" def _A ( UpperCamelCase_ : Any) -> List[str]: '''simple docstring''' __lowercase ,__lowercase = [], [] while len(UpperCamelCase_) > 1: __lowercase ,__lowercase = min(UpperCamelCase_), max(UpperCamelCase_) start.append(Uppe...
17
0
import unittest from transformers.testing_utils import require_bsa from transformers.utils import is_bsa_available from ...test_feature_extraction_common import FeatureExtractionSavingTestMixin if is_bsa_available(): from transformers import MarkupLMFeatureExtractor class __lowercase ( unittest.Test...
13
"""simple docstring""" def _A ( UpperCamelCase_ : list[int]) -> float: '''simple docstring''' if not nums: # Makes sure that the list is not empty raise ValueError("List is empty") __lowercase = sum(UpperCamelCase_) / len(UpperCamelCase_) # Calculate the average...
17
0
def A ( a_ ,a_ ) -> int: return int((input_a, input_a).count(1 ) != 0 ) def A ( ) -> None: assert or_gate(0 ,0 ) == 0 assert or_gate(0 ,1 ) == 1 assert or_gate(1 ,0 ) ==...
71
"""simple docstring""" import inspect import unittest import numpy as np from transformers import BeitConfig from transformers.testing_utils import require_flax, require_vision, slow from transformers.utils import cached_property, is_flax_available, is_vision_available from ...test_configuration_common import...
17
0
'''simple docstring''' import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def lowercase_ ( lowerCAmelCase__ : Dict , lowerCAmelCase__ : Dict=() , ...
254
"""simple docstring""" import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class _lowerCAmelCase ( unittest.TestCase ,lowercase ): """simple docstring""" def _lowercase ( self : List[Any] ): __lowercase = ...
17
0
'''simple docstring''' import unittest from transformers import MPNetConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask...
265
"""simple docstring""" from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, Stabl...
17
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaImgaImgPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import f...
221
"""simple docstring""" import random import unittest import numpy as np import torch from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionUpscalePipeline, PNDMScheduler, ) from diffusers.ut...
17
0
import asyncio import os import shutil import subprocess import sys import tempfile import unittest from distutils.util import strtobool from functools import partial from pathlib import Path from typing import List, Union from unittest import mock import torch from ..state import AcceleratorState, PartialState...
326
"""simple docstring""" import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datasets.table import table_ca...
17
0
import unittest from queue import Empty from threading import Thread from transformers import AutoTokenizer, TextIteratorStreamer, TextStreamer, is_torch_available from transformers.testing_utils import CaptureStdout, require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_availab...
26
"""simple docstring""" from scipy.stats import spearmanr import datasets _a = '\nThe Spearman rank-order correlation coefficient is a measure of the\nrelationship between two datasets. Like other correlation coefficients,\nthis one varies between -1 and +1 with 0 implying no correlation.\nPositive...
17
0
"""simple docstring""" import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class lowercase_ ( pl.LightningModule ): '''simple docstring''' def __init__( self : Optiona...
315
"""simple docstring""" from collections.abc import Sequence def _A ( UpperCamelCase_ : Sequence[float], UpperCamelCase_ : float) -> float: '''simple docstring''' return sum(c * (x**i) for i, c in enumerate(UpperCamelCase_)) def _A ( UpperCamelCase_ : S...
17
0
from sklearn.metrics import mean_squared_error import datasets lowercase__ : int = '''\\n@article{scikit-learn,\n title={Scikit-learn: Machine Learning in {P}ython},\n author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V.\n and Thirion, B. and Grisel, O. and Blondel, M. and Prett...
338
"""simple docstring""" import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class _lowerCAmelCase ( pl.LightningModule ): """simple docstring""" def __init__( self : Option...
17
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) a__ : Union[str, Any] ={'''configuration_plbart''': ['''PLBART_PRETRAINED_CONFIG...
53
"""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...
17
0
from math import sqrt def UpperCamelCase ( __lowerCamelCase : int ): snake_case : List[Any] = 0 for i in range(1 , int(sqrt(UpperCamelCase_ ) + 1 ) ): if n % i == 0 and i != sqrt(UpperCamelCase_ ): total +...
59
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
17
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase : str = { """configuration_upernet""": ["""UperNetConfig"""], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except ...
13
"""simple docstring""" import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( Autoenco...
17
0
import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( Ma...
71
"""simple docstring""" from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin,...
17
0
'''simple docstring''' from pathlib import Path import fire from tqdm import tqdm def lowercase_ ( lowerCAmelCase__ : Optional[Any]="ro" , lowerCAmelCase__ : str="en" , lowerCAmelCase__ : Union[str, Any]="wmt16" , lowerCAmelCase__ : Tuple=None ): ...
254
"""simple docstring""" import time from contextlib import contextmanager from pathlib import Path import pytest import requests from huggingface_hub.hf_api import HfApi, HfFolder _a = '__DUMMY_TRANSFORMERS_USER__' _a = 'Dummy User' _a = 'hf_hZEmnoOEYISjraJtbySaKCNnSuYAvukaT...
17
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging a : List[str] = logging.get_logger(__name__) a : Dict = { """vinvino02/glpn-kitti""": """https://huggingface.co/vinvino02/glpn-kitti/resolve/main/config.json""", # See all...
265
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { 'huggingface/time-series-transformer-tourism-monthly': ( 'https://huggingface.co/huggin...
17
0
"""simple docstring""" def UpperCAmelCase ( UpperCamelCase__ , UpperCamelCase__ ): """simple docstring""" if not isinstance(UpperCamelCase_ , UpperCamelCase_ ): raise ValueError('iterations must be defined as integers' ) if not isi...
221
"""simple docstring""" import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import ( ...
17
0
import logging import os from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional from tqdm import auto as tqdm_lib _UpperCamelCase = { '''debug'''...
326
"""simple docstring""" import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE from tra...
17
0
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_available(): from .tokenization_big_bird impor...
26
"""simple docstring""" from __future__ import annotations from typing import Any class _lowerCAmelCase : """simple docstring""" def __init__( self : Any, UpperCAmelCase__ : int ): __lowercase = num_of_nodes __lowercase = [] __lo...
17
0
"""simple docstring""" from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def _snake_case ( ) -> tuple[list[int], int]: '''simple docstring''' _A = [randint(-10_00 , 10_00 ) f...
315
"""simple docstring""" from math import sqrt def _A ( UpperCamelCase_ : int) -> int: '''simple docstring''' __lowercase = 0 for i in range(1, int(sqrt(UpperCamelCase_) + 1)): if n % i == 0 and i != sqrt(UpperCamelCase_): total += i + n // i eli...
17
0
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation lowercase__ : Li...
338
"""simple docstring""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) _a = ...
17
0
'''simple docstring''' from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) a__ : ...
53
"""simple docstring""" import baseaa def _A ( UpperCamelCase_ : str) -> bytes: '''simple docstring''' return baseaa.baaencode(string.encode("utf-8")) def _A ( UpperCamelCase_ : bytes) -> str: '''simple docstring''' return baseaa.baadecode(UpperCamelCa...
17
0
import io import math from typing import Dict, Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension_format, to_pil_image from ...i...
59
"""simple docstring""" def _A ( UpperCamelCase_ : Any) -> List[str]: '''simple docstring''' __lowercase ,__lowercase = [], [] while len(UpperCamelCase_) > 1: __lowercase ,__lowercase = min(UpperCamelCase_), max(UpperCamelCase_) start.append(Uppe...
17
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowerCAmelCase : Optional[int] = { """configuration_bridgetower""": [ """BRIDGETOWER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BridgeTowerConfig""...
13
"""simple docstring""" def _A ( UpperCamelCase_ : list[int]) -> float: '''simple docstring''' if not nums: # Makes sure that the list is not empty raise ValueError("List is empty") __lowercase = sum(UpperCamelCase_) / len(UpperCamelCase_) # Calculate the average...
17
0
from __future__ import annotations def A ( a_ ) -> bool: __UpperCamelCase : List[Any] =len(UpperCamelCase_ ) # We need to create solution object to save path. __UpperCamelCase : Union[str, Any] =[[0 for _ in...
71
"""simple docstring""" import inspect import unittest import numpy as np from transformers import BeitConfig from transformers.testing_utils import require_flax, require_vision, slow from transformers.utils import cached_property, is_flax_available, is_vision_available from ...test_configuration_common import...
17
0
'''simple docstring''' from ..models.whisper import WhisperForConditionalGeneration, WhisperProcessor from .base import PipelineTool class _A ( __SCREAMING_SNAKE_CASE ): _SCREAMING_SNAKE_CASE : Tuple = "openai/whisper-base" _SCREAMING_SNAKE_CASE : Union[str, Any] = (...
254
"""simple docstring""" import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class _lowerCAmelCase ( unittest.TestCase ,lowercase ): """simple docstring""" def _lowercase ( self : List[Any] ): __lowercase = ...
17
0
'''simple docstring''' import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import ( ...
265
"""simple docstring""" from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, Stabl...
17
0
"""simple docstring""" import os import tempfile import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from torch import nn from transformers import ( Adafactor, AdamW,...
221
"""simple docstring""" import random import unittest import numpy as np import torch from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionUpscalePipeline, PNDMScheduler, ) from diffusers.ut...
17
0
def lowerCAmelCase__( lowercase : list[list[int]] , lowercase : int , lowercase : int , lowercase : list[int] ) -> bool: if graph[path[curr_ind - 1]][next_ver] == 0: return False # 2. Validate that next vertex is not already in path return not an...
326
"""simple docstring""" import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datasets.table import table_ca...
17
0
import os import unittest from transformers import FunnelTokenizer, FunnelTokenizerFast from transformers.models.funnel.tokenization_funnel import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers cl...
26
"""simple docstring""" from scipy.stats import spearmanr import datasets _a = '\nThe Spearman rank-order correlation coefficient is a measure of the\nrelationship between two datasets. Like other correlation coefficients,\nthis one varies between -1 and +1 with 0 implying no correlation.\nPositive...
17
0
"""simple docstring""" import unittest import numpy as np import requests from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs ...
315
"""simple docstring""" from collections.abc import Sequence def _A ( UpperCamelCase_ : Sequence[float], UpperCamelCase_ : float) -> float: '''simple docstring''' return sum(c * (x**i) for i, c in enumerate(UpperCamelCase_)) def _A ( UpperCamelCase_ : S...
17
0
from ...configuration_utils import PretrainedConfig lowercase__ : int = { '''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/googl...
338
"""simple docstring""" import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class _lowerCAmelCase ( pl.LightningModule ): """simple docstring""" def __init__( self : Option...
17
0
'''simple docstring''' import warnings from ...utils import logging from .image_processing_segformer import SegformerImageProcessor a__ : int =logging.get_logger(__name__) class snake_case ( __lowerCamelCase ): """simple docstring""" def __init__( self : ...
53
"""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...
17
0
from math import pow, sqrt def UpperCamelCase ( *__lowerCamelCase : float ): snake_case : Optional[int] = len(UpperCamelCase_ ) > 0 and all(value > 0.0 for value in values ) return result def UpperCamelCase ( __lowerCamelCase : float ...
59
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
17
0
from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass lowerCAmelCase : Union[str, Any] = (3, 9, -11, 0, 7, 5, 1, -1) lowerCAmelCase : str = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class __lowercase : """simple d...
13
"""simple docstring""" import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( Autoenco...
17
0
import unittest from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_com...
71
"""simple docstring""" from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin,...
17
0
'''simple docstring''' from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import ( BaseOutput, OptionalDependencyNotAvailable, is_flax_available, is_k_diffusion_available, is_k_diffusion_...
254
"""simple docstring""" import time from contextlib import contextmanager from pathlib import Path import pytest import requests from huggingface_hub.hf_api import HfApi, HfFolder _a = '__DUMMY_TRANSFORMERS_USER__' _a = 'Dummy User' _a = 'hf_hZEmnoOEYISjraJtbySaKCNnSuYAvukaT...
17
0
'''simple docstring''' def __lowerCamelCase ( _lowercase , _lowercase ) -> float: def get_matched_characters(_lowercase , _lowercase ) -> str: UpperCAmelCase : List[Any] = [] UpperCAmelCase : Tuple = min(len(_stra ...
265
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { 'huggingface/time-series-transformer-tourism-monthly': ( 'https://huggingface.co/huggin...
17
0
"""simple docstring""" import inspect import unittest from transformers import DecisionTransformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import Conf...
221
"""simple docstring""" import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import ( ...
17
0
import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data import IterableDataset fro...
326
"""simple docstring""" import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE from tra...
17
0
def lowerCAmelCase_ ( snake_case_,snake_case_ ): return int((input_a, input_a).count(0 ) == 0 ) def lowerCAmelCase_ ( ): assert and_gate(0,0 ) == 0 assert and_gate(0,1 ) == 0 assert and_gate(1,0 ) == 0 assert and_gate(1,1 ) == 1 if ...
26
"""simple docstring""" from __future__ import annotations from typing import Any class _lowerCAmelCase : """simple docstring""" def __init__( self : Any, UpperCAmelCase__ : int ): __lowercase = num_of_nodes __lowercase = [] __lo...
17
0
"""simple docstring""" import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Image from .base import TaskTemplate @dataclass(frozen=__lowerCAmelCase ) class lowercase_ ( __lowerCAmelCase ): '''simple ...
315
"""simple docstring""" from math import sqrt def _A ( UpperCamelCase_ : int) -> int: '''simple docstring''' __lowercase = 0 for i in range(1, int(sqrt(UpperCamelCase_) + 1)): if n % i == 0 and i != sqrt(UpperCamelCase_): total += i + n // i eli...
17
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase__ : Dict = logging.get_logger(__name__) lowercase__ : Optional[Any] = { '''YituTech/conv-bert-base''': '...
338
"""simple docstring""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) _a = ...
17
0
'''simple docstring''' import argparse import torch from transformers import OpenAIGPTConfig, OpenAIGPTModel, load_tf_weights_in_openai_gpt from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowercase__ ( __lowercase : Union[str, Any] , __lower...
53
"""simple docstring""" import baseaa def _A ( UpperCamelCase_ : str) -> bytes: '''simple docstring''' return baseaa.baaencode(string.encode("utf-8")) def _A ( UpperCamelCase_ : bytes) -> str: '''simple docstring''' return baseaa.baadecode(UpperCamelCa...
17
0
from typing import TYPE_CHECKING from ..utils import _LazyModule __lowerCamelCase = { """config""": [ """EXTERNAL_DATA_FORMAT_SIZE_LIMIT""", """OnnxConfig""", """OnnxConfigWithPast""", """OnnxSeq2SeqConfigWithPast""", """PatchingSpec""", ], ...
59
"""simple docstring""" def _A ( UpperCamelCase_ : Any) -> List[str]: '''simple docstring''' __lowercase ,__lowercase = [], [] while len(UpperCamelCase_) > 1: __lowercase ,__lowercase = min(UpperCamelCase_), max(UpperCamelCase_) start.append(Uppe...
17
0
from __future__ import annotations def A_ ( _UpperCAmelCase ): create_state_space_tree(UpperCamelCase_ , [] , 0 , [0 for i in range(len(UpperCamelCase_ ) )] ) def A_ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , ): ...
13
"""simple docstring""" def _A ( UpperCamelCase_ : list[int]) -> float: '''simple docstring''' if not nums: # Makes sure that the list is not empty raise ValueError("List is empty") __lowercase = sum(UpperCamelCase_) / len(UpperCamelCase_) # Calculate the average...
17
0
from __future__ import annotations from typing import Any class __A : """simple docstring""" def __init__( self , lowerCamelCase__ ): """simple docstring""" __UpperCamelCase : Optional[Any] =num_...
71
"""simple docstring""" import inspect import unittest import numpy as np from transformers import BeitConfig from transformers.testing_utils import require_flax, require_vision, slow from transformers.utils import cached_property, is_flax_available, is_vision_available from ...test_configuration_common import...
17
0
'''simple docstring''' import os import tempfile import unittest from transformers import DistilBertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common...
254
"""simple docstring""" import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class _lowerCAmelCase ( unittest.TestCase ,lowercase ): """simple docstring""" def _lowercase ( self : List[Any] ): __lowercase = ...
17
0
'''simple docstring''' def __lowerCamelCase ( _lowercase = 1_0 , _lowercase = 1_0_0_0 , _lowercase = True ) -> int: assert ( isinstance(UpperCamelCase_ , UpperCamelCase_ ) and isinstance(UpperCamelCase_ , UpperCamelCase_ ) and isinstance(U...
265
"""simple docstring""" from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, Stabl...
17
0
"""simple docstring""" __lowerCamelCase = 8.3_1_4_4_5_9_8 def UpperCAmelCase ( UpperCamelCase__ , UpperCamelCase__ ): """simple docstring""" if temperature < 0: raise Exception('Temperature cannot be less than 0 K' ) ...
221
"""simple docstring""" import random import unittest import numpy as np import torch from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionUpscalePipeline, PNDMScheduler, ) from diffusers.ut...
17
0
import numpy as np # Importing the Keras libraries and packages import tensorflow as tf from tensorflow.keras import layers, models if __name__ == "__main__": # Initialising the CNN # (Sequential- Building the model layer by layer) _UpperCamelCase = models.Sequential() # Step 1 - C...
326
"""simple docstring""" import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datasets.table import table_ca...
17
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _snake_case = {"configuration_fnet": ["FNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "FNetConfig"]} try: if...
26
"""simple docstring""" from scipy.stats import spearmanr import datasets _a = '\nThe Spearman rank-order correlation coefficient is a measure of the\nrelationship between two datasets. Like other correlation coefficients,\nthis one varies between -1 and +1 with 0 implying no correlation.\nPositive...
17
0
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LDMTextToImagePipeline, UNetaDConditionModel from diffusers.utils.testing_utils import ( enable_full_dete...
315
"""simple docstring""" from collections.abc import Sequence def _A ( UpperCamelCase_ : Sequence[float], UpperCamelCase_ : float) -> float: '''simple docstring''' return sum(c * (x**i) for i, c in enumerate(UpperCamelCase_)) def _A ( UpperCamelCase_ : S...
17
0
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin lowercase__ : str = '''\nHugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that developed a chatbot app targeted at teenage...
338
"""simple docstring""" import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class _lowerCAmelCase ( pl.LightningModule ): """simple docstring""" def __init__( self : Option...
17
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a__ : Optional[Any] ={ '''configuration_jukebox''': [ '''JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''JukeboxConfig''', '''Jukebox...
53
"""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...
17
0
from __future__ import annotations import unittest from transformers import DistilBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention...
59
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
17
0
import math def A_ ( _UpperCAmelCase ): assert isinstance(UpperCamelCase_ , UpperCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or not n...
13
"""simple docstring""" import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( Autoenco...
17
0
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 ...test_configuration_...
71
"""simple docstring""" from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin,...
17
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCamelCase = logging.get_logger(__name__) _UpperCamelCase = { '''google/fnet-base''': '''https://huggingface.co/google/fnet-base/resolve/main/config.json''', '''google/f...
254
"""simple docstring""" import time from contextlib import contextmanager from pathlib import Path import pytest import requests from huggingface_hub.hf_api import HfApi, HfFolder _a = '__DUMMY_TRANSFORMERS_USER__' _a = 'Dummy User' _a = 'hf_hZEmnoOEYISjraJtbySaKCNnSuYAvukaT...
17
0
'''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 ( MobileViTConfig, MobileViTForImageClassification, MobileViTForSemanticSegmentation, MobileViTIma...
265
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { 'huggingface/time-series-transformer-tourism-monthly': ( 'https://huggingface.co/huggin...
17
0
"""simple docstring""" from __future__ import annotations import time __lowerCamelCase = list[tuple[int, int]] __lowerCamelCase = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0...
221
"""simple docstring""" import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import ( ...
17
0
from typing import Dict, List, Optional, Tuple, 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, resize, to_channel_dimension_for...
326
"""simple docstring""" import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE from tra...
17
0
import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( """files""",[ ["""full:README.md""", """dataset_infos.json"""], ["""empty:README.md""", """dataset_infos.json"""]...
26
"""simple docstring""" from __future__ import annotations from typing import Any class _lowerCAmelCase : """simple docstring""" def __init__( self : Any, UpperCAmelCase__ : int ): __lowercase = num_of_nodes __lowercase = [] __lo...
17
0
"""simple docstring""" import argparse import torch from safetensors.torch import load_file from diffusers import StableDiffusionPipeline def _snake_case ( _snake_case : Optional[Any] , _snake_case : Any , _snake_case : Dict , _snake_case : ...
315
"""simple docstring""" from math import sqrt def _A ( UpperCamelCase_ : int) -> int: '''simple docstring''' __lowercase = 0 for i in range(1, int(sqrt(UpperCamelCase_) + 1)): if n % i == 0 and i != sqrt(UpperCamelCase_): total += i + n // i eli...
17
0