code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
'''simple docstring''' def __magic_name__( lowerCamelCase = 1_0_0_0_0_0_0): __lowerCAmelCase = set(range(3, lowerCamelCase, 2)) primes.add(2) for p in range(3, lowerCamelCase, 2): if p not in primes: continue primes.d...
9
'''simple docstring''' # Imports import numpy as np class a__ : """simple docstring""" def __init__(self , __lowercase=None , __lowercase=None , __lowercase=None , __lowercase=None , __lowercase=None ): self.set_matricies...
9
1
'''simple docstring''' import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller _UpperCAmelCase : List[Any] = 3 def __magic_name__( lowerCamelCase): print('''Generating primitive root of p''') while True: ...
9
'''simple docstring''' from math import sqrt def __magic_name__( lowerCamelCase): assert isinstance(lowerCamelCase, lowerCamelCase) and ( number >= 0 ), "'number' must been an int and positive" __lowerCAmelCase = True # 0 and 1 are none primes...
9
1
'''simple docstring''' import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, ...
9
'''simple docstring''' import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from acceler...
9
1
'''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 transf...
9
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _UpperCAmelCase : str = logging.get_logger(__name__) _UpperCAmelCase : str ...
9
1
'''simple docstring''' import unicodedata from dataclasses import dataclass from typing import Optional, Union import numpy as np from transformers.data.data_collator import DataCollatorMixin from transformers.file_utils import PaddingStrategy from transformers.tokenization_utils_base import PreTrain...
9
'''simple docstring''' import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassifi...
9
1
'''simple docstring''' from typing import Optional, Tuple import jax import jax.numpy as jnp from flax import linen as nn from flax.core.frozen_dict import FrozenDict from transformers import CLIPConfig, FlaxPreTrainedModel from transformers.models.clip.modeling_flax_clip import FlaxCLIPVisionModule ...
9
'''simple docstring''' from __future__ import annotations import math def __magic_name__( lowerCamelCase, lowerCamelCase): if len(lowerCamelCase) != 2 or len(a[0]) != 2 or len(lowerCamelCase) != 2 or len(b[0]) != 2: raise Exception('''Matrices are not 2x2''') __lowerC...
9
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class a__ ( metaclass=__A ): """simple docstring""" __UpperCamelCase : Dict = ['keras_nlp'] def __init__(self , *__lowercase , **__lowercase ): ...
9
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import requ...
9
1
'''simple docstring''' class a__ : """simple docstring""" def __init__(self , __lowercase ): __lowerCAmelCase = len(__lowercase ) __lowerCAmelCase = [0] * len_array if len_array > 0: __...
9
'''simple docstring''' 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 a__ ( _...
9
1
'''simple docstring''' import unittest from transformers import BigBirdConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax from t...
9
'''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/L...
9
1
'''simple docstring''' def __magic_name__( lowerCamelCase): if num < 0: return False __lowerCAmelCase = num __lowerCAmelCase = 0 while num > 0: __lowerCAmelCase = rev_num * 1_0 + (num % 1_0) num //=...
9
'''simple docstring''' def __magic_name__( lowerCamelCase): __lowerCAmelCase = 1 __lowerCAmelCase = 2 while i * i <= n: __lowerCAmelCase = 0 while n % i == 0: n //= i multiplicity +=...
9
1
'''simple docstring''' from __future__ import annotations def __magic_name__( lowerCamelCase): __lowerCAmelCase = 0.00 __lowerCAmelCase = 0 for resistor in resistors: if resistor <= 0: __lowerCAmelCase = F"""Res...
9
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class a__ ( unittest.TestCase ): ...
9
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _UpperCAmelCase : List[str] = logging.get_logger(__name__) _UpperCAmelCase : Opti...
9
'''simple docstring''' from typing import Dict, Optional import numpy as np import datasets _UpperCAmelCase : List[str] = """ IoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union between the predicted segmentation and the gro...
9
1
'''simple docstring''' from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException ...
9
'''simple docstring''' import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTest...
9
1
'''simple docstring''' 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 ..st...
9
'''simple docstring''' import argparse import datetime def __magic_name__( lowerCamelCase): __lowerCAmelCase = { '''0''': '''Sunday''', '''1''': '''Monday''', '''2''': '''Tuesday''', '''3''': '''Wednesday''', '''4''': '''Thur...
9
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_donut import DonutImageProcessor _UpperCAmelCase : Optional[int] = logging.get_logger(__name__) class a__ ( __A ): """simple docstring""" def __init__(self ...
9
'''simple docstring''' import gc import unittest import numpy as np import torch from torch.backends.cuda import sdp_kernel from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) from diffusers.utils import randn_tensor, slow, torch_device fr...
9
1
'''simple docstring''' import math import os import re import sys import unittest from pathlib import Path from typing import Tuple from unittest.mock import patch from parameterized import parameterized from transformers.testing_utils import ( CaptureStderr, ExtendSysPath, TestCase...
9
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _UpperCAmelCase : List[Any] = datasets.load_iris() _UpperCAmelCase : Dict = np.array(data["""data"""]) _UpperCA...
9
1
'''simple docstring''' import gc import unittest import numpy as np import torch from torch.backends.cuda import sdp_kernel from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) from diffusers.utils import randn_tensor, slow, torch_device fr...
9
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import requ...
9
1
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _UpperCAmelCase : int = logging.get_logger(__name__) ...
9
'''simple docstring''' from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def __magic_name__( ): __lowerCAmelCase = [randint(-1_0_0_0, 1_0_0_0) for i in range(1_0)] __lowerCAmelCase = ...
9
1
'''simple docstring''' class a__ : """simple docstring""" def __init__(self , __lowercase ): # we need a list not a string, so do something to change the type __lowerCAmelCase = arr.split(''',''' ) def _snake_ca...
9
'''simple docstring''' import numpy as np def __magic_name__( lowerCamelCase, lowerCamelCase, lowerCamelCase = 1E-12, lowerCamelCase = 1_0_0, ): assert np.shape(lowerCamelCase)[0] == np.shape(lowerCamelCase)[1] # Ensure proper dimensionality. assert np.shape(lowerCamelCa...
9
1
'''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 _UpperCAmelCase : List[str] = logging.get_logger(__na...
9
'''simple docstring''' from typing import Dict, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import flip_channel_order, resize, to_channel_dimension_format, to_pil_image from ...image_utils import ( ...
9
1
'''simple docstring''' from itertools import product def __magic_name__( lowerCamelCase, lowerCamelCase): __lowerCAmelCase = sides_number __lowerCAmelCase = max_face_number * dice_number __lowerCAmelCase = [0] * (max_total + 1) __lo...
9
'''simple docstring''' from ..utils import DummyObject, requires_backends class a__ ( metaclass=__A ): """simple docstring""" __UpperCamelCase : int = ['torch', 'scipy'] def __init__(self , *__lowercase , **__lowercase ): ...
9
1
'''simple docstring''' import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartTokenizer, MBartTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require...
9
'''simple docstring''' import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProces...
9
1
'''simple docstring''' import argparse import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( CLIPTokenizer, CLIPTokenizerFast, VideoMAEImageProcessor, XCLIPConfig, XCLIPModel, XCLIPProcessor, XCLIPTextConf...
9
'''simple docstring''' # Imports import numpy as np class a__ : """simple docstring""" def __init__(self , __lowercase=None , __lowercase=None , __lowercase=None , __lowercase=None , __lowercase=None ): self.set_matricies...
9
1
'''simple docstring''' from PIL import Image def __magic_name__( lowerCamelCase): __lowerCAmelCase , __lowerCAmelCase = image.size __lowerCAmelCase = 0 __lowerCAmelCase = image.load() for i in range(lowerCamelCase): fo...
9
'''simple docstring''' from math import sqrt def __magic_name__( lowerCamelCase): assert isinstance(lowerCamelCase, lowerCamelCase) and ( number >= 0 ), "'number' must been an int and positive" __lowerCAmelCase = True # 0 and 1 are none primes...
9
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, PegasusConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...t...
9
'''simple docstring''' import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from acceler...
9
1
'''simple docstring''' def __magic_name__( lowerCamelCase = 1_0, lowerCamelCase = 1_0_0_0, lowerCamelCase = True): assert ( isinstance(lowerCamelCase, lowerCamelCase) and isinstance(lowerCamelCase, lowerCamelCase) and isinstance(lowerCamelCase, lowerCam...
9
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _UpperCAmelCase : str = logging.get_logger(__name__) _UpperCAmelCase : str ...
9
1
'''simple docstring''' 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 PaddingStr...
9
'''simple docstring''' import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassifi...
9
1
'''simple docstring''' import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": _UpperCAmelCase : Optional[Any] = argparse.ArgumentParser( description=( """Extraction some layers of the full BertForMaskedLM or RObertaForMasked...
9
'''simple docstring''' from __future__ import annotations import math def __magic_name__( lowerCamelCase, lowerCamelCase): if len(lowerCamelCase) != 2 or len(a[0]) != 2 or len(lowerCamelCase) != 2 or len(b[0]) != 2: raise Exception('''Matrices are not 2x2''') __lowerC...
9
1
'''simple docstring''' import argparse import os import sys from unittest.mock import patch import pytorch_lightning as pl import timeout_decorator import torch from distillation import SummarizationDistiller, distill_main from finetune import SummarizationModule, main from transformers import Mar...
9
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import requ...
9
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _UpperCAmelCase : Any = { """configuration_r...
9
'''simple docstring''' 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 a__ ( _...
9
1
'''simple docstring''' from . import ( albert, align, altclip, audio_spectrogram_transformer, auto, autoformer, bark, bart, barthez, bartpho, beit, bert, bert_generation, bert_japanese, bertweet, big_bird, bigbird_pegasus, ...
9
'''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/L...
9
1
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
9
'''simple docstring''' def __magic_name__( lowerCamelCase): __lowerCAmelCase = 1 __lowerCAmelCase = 2 while i * i <= n: __lowerCAmelCase = 0 while n % i == 0: n //= i multiplicity +=...
9
1
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
9
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class a__ ( unittest.TestCase ): ...
9
1
'''simple docstring''' from dataclasses import dataclass from typing import Dict, Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .attention_processor import AttentionPr...
9
'''simple docstring''' from typing import Dict, Optional import numpy as np import datasets _UpperCAmelCase : List[str] = """ IoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union between the predicted segmentation and the gro...
9
1
'''simple docstring''' import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) from transform...
9
'''simple docstring''' import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTest...
9
1
'''simple docstring''' _UpperCAmelCase : Dict = 8.31_44_62 # Unit - J mol-1 K-1 def __magic_name__( lowerCamelCase, lowerCamelCase, lowerCamelCase): if moles < 0 or kelvin < 0 or volume < 0: raise ValueError('''Invalid inputs. Enter positive value.''') ...
9
'''simple docstring''' import argparse import datetime def __magic_name__( lowerCamelCase): __lowerCAmelCase = { '''0''': '''Sunday''', '''1''': '''Monday''', '''2''': '''Tuesday''', '''3''': '''Wednesday''', '''4''': '''Thur...
9
1
'''simple docstring''' from __future__ import annotations class a__ : """simple docstring""" def __init__(self , __lowercase ): __lowerCAmelCase = TypeError( '''Matrices must be formed from a list of zero or more lists cont...
9
'''simple docstring''' import gc import unittest import numpy as np import torch from torch.backends.cuda import sdp_kernel from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) from diffusers.utils import randn_tensor, slow, torch_device fr...
9
1
'''simple docstring''' def __magic_name__( lowerCamelCase): if num <= 0: raise ValueError('''Input must be a positive integer''') __lowerCAmelCase = [True] * (num + 1) __lowerCAmelCase = 2 while p * p <= num: if primes[...
9
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _UpperCAmelCase : List[Any] = datasets.load_iris() _UpperCAmelCase : Dict = np.array(data["""data"""]) _UpperCA...
9
1
'''simple docstring''' from __future__ import annotations import os from collections.abc import Mapping _UpperCAmelCase : Dict = tuple[int, int] class a__ : """simple docstring""" def __init__(self , __lowercase , __lowercase ): ...
9
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import requ...
9
1
'''simple docstring''' from typing import Dict, Optional import numpy as np import datasets _UpperCAmelCase : List[str] = """ IoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union between the predicted segmentation and the gro...
9
'''simple docstring''' from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def __magic_name__( ): __lowerCAmelCase = [randint(-1_0_0_0, 1_0_0_0) for i in range(1_0)] __lowerCAmelCase = ...
9
1
'''simple docstring''' 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 a__ ( _...
9
'''simple docstring''' import numpy as np def __magic_name__( lowerCamelCase, lowerCamelCase, lowerCamelCase = 1E-12, lowerCamelCase = 1_0_0, ): assert np.shape(lowerCamelCase)[0] == np.shape(lowerCamelCase)[1] # Ensure proper dimensionality. assert np.shape(lowerCamelCa...
9
1
'''simple docstring''' import torch from diffusers import StableDiffusionPipeline _UpperCAmelCase : Any = """path-to-your-trained-model""" _UpperCAmelCase : Optional[int] = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.floataa).to("""cuda""") _U...
9
'''simple docstring''' from typing import Dict, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import flip_channel_order, resize, to_channel_dimension_format, to_pil_image from ...image_utils import ( ...
9
1
'''simple docstring''' from typing import Optional from torch import nn from .transformer_ad import TransformeraDModel, TransformeraDModelOutput class a__ ( nn.Module ): """simple docstring""" def __init__(self , __lowercase = 16 , __lowercase = 88 ,...
9
'''simple docstring''' from ..utils import DummyObject, requires_backends class a__ ( metaclass=__A ): """simple docstring""" __UpperCamelCase : int = ['torch', 'scipy'] def __init__(self , *__lowercase , **__lowercase ): ...
9
1
'''simple docstring''' from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils...
9
'''simple docstring''' import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProces...
9
1
'''simple docstring''' from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def __magic_name__( lowerCamelCase, lowerCamelCase, lowerCamelCase = "x", lowerCamelCase = 1_0**-1_0, lowerCamelCase = 1, ): __lowerCAmelCase = symbols(lowerCame...
9
'''simple docstring''' # Imports import numpy as np class a__ : """simple docstring""" def __init__(self , __lowercase=None , __lowercase=None , __lowercase=None , __lowercase=None , __lowercase=None ): self.set_matricies...
9
1
'''simple docstring''' import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_ava...
9
'''simple docstring''' from math import sqrt def __magic_name__( lowerCamelCase): assert isinstance(lowerCamelCase, lowerCamelCase) and ( number >= 0 ), "'number' must been an int and positive" __lowerCAmelCase = True # 0 and 1 are none primes...
9
1
'''simple docstring''' def __magic_name__( lowerCamelCase, lowerCamelCase): if density <= 0: raise ValueError('''Impossible fluid density''') if bulk_modulus <= 0: raise ValueError('''Impossible bulk modulus''') return (bulk_modulus / density) ** 0.5...
9
'''simple docstring''' import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from acceler...
9
1
'''simple docstring''' import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import...
9
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _UpperCAmelCase : str = logging.get_logger(__name__) _UpperCAmelCase : str ...
9
1
'''simple docstring''' # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.multicontrolnet import MultiControlNetModel # noqa: F401 from ..co...
9
'''simple docstring''' import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassifi...
9
1
'''simple docstring''' from __future__ import annotations def __magic_name__( lowerCamelCase, lowerCamelCase): # Checks if the entire collection has been sorted if len(lowerCamelCase) <= 1 or n <= 1: return insert_next(lowerCamelCase, n - 1) rec_inserti...
9
'''simple docstring''' from __future__ import annotations import math def __magic_name__( lowerCamelCase, lowerCamelCase): if len(lowerCamelCase) != 2 or len(a[0]) != 2 or len(lowerCamelCase) != 2 or len(b[0]) != 2: raise Exception('''Matrices are not 2x2''') __lowerC...
9
1
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common impo...
9
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import requ...
9
1
'''simple docstring''' import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStruct...
9
'''simple docstring''' 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 a__ ( _...
9
1
'''simple docstring''' import copy import re class a__ : """simple docstring""" __UpperCamelCase : Union[str, Any] = 'hp' __UpperCamelCase : Any = {} __UpperCamelCase : List[str] = None @classmethod def _s...
9
'''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/L...
9
1
'''simple docstring''' _UpperCAmelCase : List[str] = """ # 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/transforme...
9
'''simple docstring''' def __magic_name__( lowerCamelCase): __lowerCAmelCase = 1 __lowerCAmelCase = 2 while i * i <= n: __lowerCAmelCase = 0 while n % i == 0: n //= i multiplicity +=...
9
1
'''simple docstring''' from abc import ABC, abstractmethod from typing import List, Optional class a__ ( __A ): """simple docstring""" def __init__(self ): # test for the above condition self.test() def _snake_case (self ...
9
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class a__ ( unittest.TestCase ): ...
9
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : Union[str, Any] = logging.get_logger(__name__) _UpperCAmelCase : Optional[int] = { """edbeeching/decision-transformer-gym-hopper-medium""": ( ...
9
'''simple docstring''' from typing import Dict, Optional import numpy as np import datasets _UpperCAmelCase : List[str] = """ IoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union between the predicted segmentation and the gro...
9
1
'''simple docstring''' import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class a__ ( unittest.TestCase ): ...
9
'''simple docstring''' import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTest...
9
1
'''simple docstring''' import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers,...
9
'''simple docstring''' import argparse import datetime def __magic_name__( lowerCamelCase): __lowerCAmelCase = { '''0''': '''Sunday''', '''1''': '''Monday''', '''2''': '''Tuesday''', '''3''': '''Wednesday''', '''4''': '''Thur...
9
1
'''simple docstring''' from typing import Any def __magic_name__( lowerCamelCase, lowerCamelCase, lowerCamelCase, lowerCamelCase, lowerCamelCase, ): _validation( lowerCamelCase, lowerCamelCase, lowerCamelCase, lowerCamelCase, lowerCamelCase, ) # Creates d...
9
'''simple docstring''' import gc import unittest import numpy as np import torch from torch.backends.cuda import sdp_kernel from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) from diffusers.utils import randn_tensor, slow, torch_device fr...
9
1
'''simple docstring''' import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _UpperC...
9
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _UpperCAmelCase : List[Any] = datasets.load_iris() _UpperCAmelCase : Dict = np.array(data["""data"""]) _UpperCA...
9
1
'''simple docstring''' 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 cl...
9
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import requ...
9
1
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
9
'''simple docstring''' from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def __magic_name__( ): __lowerCAmelCase = [randint(-1_0_0_0, 1_0_0_0) for i in range(1_0)] __lowerCAmelCase = ...
9
1
'''simple docstring''' from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def __magic_name__( lowerCamelCase): return ConvertCommand( args.model_type, args.tf_checkpoint, args.pytorch_dump_output, args.confi...
9
'''simple docstring''' import numpy as np def __magic_name__( lowerCamelCase, lowerCamelCase, lowerCamelCase = 1E-12, lowerCamelCase = 1_0_0, ): assert np.shape(lowerCamelCase)[0] == np.shape(lowerCamelCase)[1] # Ensure proper dimensionality. assert np.shape(lowerCamelCa...
9
1
'''simple docstring''' _UpperCAmelCase : List[Any] = tuple[float, float, float] _UpperCAmelCase : List[Any] = tuple[float, float, float] def __magic_name__( lowerCamelCase, lowerCamelCase): __lowerCAmelCase = end_pointa[0] - end_pointa[0] ...
9
'''simple docstring''' from typing import Dict, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import flip_channel_order, resize, to_channel_dimension_format, to_pil_image from ...image_utils import ( ...
9
1
'''simple docstring''' import multiprocessing from typing import TYPE_CHECKING, Optional, Union from .. import Dataset, Features, config from ..formatting import query_table from ..packaged_modules.sql.sql import Sql from ..utils import logging from .abc import AbstractDatasetInputStream if TYPE_C...
9
'''simple docstring''' from ..utils import DummyObject, requires_backends class a__ ( metaclass=__A ): """simple docstring""" __UpperCamelCase : int = ['torch', 'scipy'] def __init__(self , *__lowercase , **__lowercase ): ...
9
1
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
9
'''simple docstring''' import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProces...
9
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCAmelCase : Any = { """configuration_timesformer""": ["""TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TimesformerConfig"""], } ...
9
'''simple docstring''' # Imports import numpy as np class a__ : """simple docstring""" def __init__(self , __lowercase=None , __lowercase=None , __lowercase=None , __lowercase=None , __lowercase=None ): self.set_matricies...
9
1
'''simple docstring''' import collections.abc from typing import Optional, Tuple, Union import torch import torch.utils.checkpoint from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutputW...
9
'''simple docstring''' from math import sqrt def __magic_name__( lowerCamelCase): assert isinstance(lowerCamelCase, lowerCamelCase) and ( number >= 0 ), "'number' must been an int and positive" __lowerCAmelCase = True # 0 and 1 are none primes...
9
1
'''simple docstring''' def __magic_name__( lowerCamelCase = 1_0_0_0): __lowerCAmelCase , __lowerCAmelCase = 1, 1 __lowerCAmelCase = [] for i in range(1, n + 1): __lowerCAmelCase = prev_numerator + 2 * prev_denominator ...
9
'''simple docstring''' import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from acceler...
9
1
'''simple docstring''' from __future__ import annotations import bisect def __magic_name__( lowerCamelCase, lowerCamelCase, lowerCamelCase = 0, lowerCamelCase = -1): if hi < 0: __lowerCAmelCase = len(lowerCamelCase) while lo < hi: __lowe...
9
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _UpperCAmelCase : str = logging.get_logger(__name__) _UpperCAmelCase : str ...
9
1
'''simple docstring''' import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from acceler...
9
'''simple docstring''' import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassifi...
9
1
'''simple docstring''' from __future__ import annotations from statistics import mean def __magic_name__( lowerCamelCase, lowerCamelCase, lowerCamelCase): __lowerCAmelCase = [0] * no_of_processes __lowerCAmelCase = [0] * no_of_processes # Initial...
9
'''simple docstring''' from __future__ import annotations import math def __magic_name__( lowerCamelCase, lowerCamelCase): if len(lowerCamelCase) != 2 or len(a[0]) != 2 or len(lowerCamelCase) != 2 or len(b[0]) != 2: raise Exception('''Matrices are not 2x2''') __lowerC...
9
1
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensorflow...
9
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import requ...
9
1
'''simple docstring''' import unittest from knapsack import greedy_knapsack as kp class a__ ( unittest.TestCase ): """simple docstring""" def _snake_case (self ): __lowerCAmelCase = [10, 20, 30, 40, 50, 60] __lowerCAmelCase ...
9
'''simple docstring''' 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 a__ ( _...
9
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _UpperCAmelCase : List[str] = logging.get_logger(__name__) _UpperCAmelCase : str ...
9
'''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/L...
9
1
'''simple docstring''' import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets _UpperCAmelCase : Optional[Any] = """\ @article{hendrycksmath2021, title={Measuring Mathematical Problem Solving With the MATH Dataset}, author={Dan Hendrycks and Co...
9
'''simple docstring''' def __magic_name__( lowerCamelCase): __lowerCAmelCase = 1 __lowerCAmelCase = 2 while i * i <= n: __lowerCAmelCase = 0 while n % i == 0: n //= i multiplicity +=...
9
1
'''simple docstring''' from __future__ import annotations from dataclasses import dataclass @dataclass class a__ : """simple docstring""" __UpperCamelCase : float __UpperCamelCase : TreeNode | None = None __UpperCamelCase : Tre...
9
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class a__ ( unittest.TestCase ): ...
9
1
'''simple docstring''' import os from datetime import datetime as dt from github import Github _UpperCAmelCase : List[str] = [ """good first issue""", """feature request""", """wip""", ] def __magic_name__( ): __lowerCAmelCase = Github(os.e...
9
'''simple docstring''' from typing import Dict, Optional import numpy as np import datasets _UpperCAmelCase : List[str] = """ IoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union between the predicted segmentation and the gro...
9
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _UpperCAmelCase : Dict = {"""configuration_swin""": ["""SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP""", """SwinConfig""", """SwinOnnxConfi...
9
'''simple docstring''' import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTest...
9
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : Tuple = logging.get_logger(__name__) _UpperCAmelCase : Optional[Any] = { """tiiuae/falcon-40b""": """https://huggingface.co/tiiuae/falcon-40b/r...
9
'''simple docstring''' import argparse import datetime def __magic_name__( lowerCamelCase): __lowerCAmelCase = { '''0''': '''Sunday''', '''1''': '''Monday''', '''2''': '''Tuesday''', '''3''': '''Wednesday''', '''4''': '''Thur...
9
1
'''simple docstring''' class a__ : """simple docstring""" def __init__(self , __lowercase , __lowercase , __lowercase ): __lowerCAmelCase = name __lowerCAmelCase = value __lowerCAmelCase ...
9
'''simple docstring''' import gc import unittest import numpy as np import torch from torch.backends.cuda import sdp_kernel from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) from diffusers.utils import randn_tensor, slow, torch_device fr...
9
1
'''simple docstring''' from math import factorial def __magic_name__( lowerCamelCase = 2_0): __lowerCAmelCase = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... __lowerCAmelCase = n // 2 return int(factori...
9
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _UpperCAmelCase : List[Any] = datasets.load_iris() _UpperCAmelCase : Dict = np.array(data["""data"""]) _UpperCA...
9
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _UpperCAmelCase : Tuple =...
9
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import requ...
9
1
'''simple docstring''' import random def __magic_name__( lowerCamelCase, lowerCamelCase, lowerCamelCase = False): __lowerCAmelCase = {i: [] for i in range(lowerCamelCase)} # if probability is greater or equal than 1, then generate a complete graph if probabilit...
9
'''simple docstring''' from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def __magic_name__( ): __lowerCAmelCase = [randint(-1_0_0_0, 1_0_0_0) for i in range(1_0)] __lowerCAmelCase = ...
9
1
'''simple docstring''' import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class a__ ( __A , unittest.TestCase ): """simple docstring"...
9
'''simple docstring''' import numpy as np def __magic_name__( lowerCamelCase, lowerCamelCase, lowerCamelCase = 1E-12, lowerCamelCase = 1_0_0, ): assert np.shape(lowerCamelCase)[0] == np.shape(lowerCamelCase)[1] # Ensure proper dimensionality. assert np.shape(lowerCamelCa...
9
1
'''simple docstring''' import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils im...
9
'''simple docstring''' from typing import Dict, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import flip_channel_order, resize, to_channel_dimension_format, to_pil_image from ...image_utils import ( ...
9
1
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_video_inputs i...
9
'''simple docstring''' from ..utils import DummyObject, requires_backends class a__ ( metaclass=__A ): """simple docstring""" __UpperCamelCase : int = ['torch', 'scipy'] def __init__(self , *__lowercase , **__lowercase ): ...
9
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _UpperCAmelCase : Optional[int] = logging.get_logger(__name__) _UpperCAmelCase ...
9
'''simple docstring''' import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProces...
9
1
'''simple docstring''' from cva import destroyAllWindows, imread, imshow, waitKey def __magic_name__( lowerCamelCase): # getting number of pixels in the image __lowerCAmelCase , __lowerCAmelCase = img.shape[0], img.shape[1] # converting each pixel's color to i...
9
'''simple docstring''' # Imports import numpy as np class a__ : """simple docstring""" def __init__(self , __lowercase=None , __lowercase=None , __lowercase=None , __lowercase=None , __lowercase=None ): self.set_matricies...
9
1
'''simple docstring''' import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fssp...
9
'''simple docstring''' from math import sqrt def __magic_name__( lowerCamelCase): assert isinstance(lowerCamelCase, lowerCamelCase) and ( number >= 0 ), "'number' must been an int and positive" __lowerCAmelCase = True # 0 and 1 are none primes...
9
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _UpperCAmelCase : str = { """configuration_data2vec_audio""": ["""DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Data2V...
9
'''simple docstring''' import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from acceler...
9
1
'''simple docstring''' import inspect import warnings from typing import Any, Dict, Optional, Union from packaging import version def __magic_name__( *lowerCamelCase, lowerCamelCase = None, lowerCamelCase=True, lowerCamelCase=2): from .. import __version__ __lowerCAmelCase...
9
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _UpperCAmelCase : str = logging.get_logger(__name__) _UpperCAmelCase : str ...
9
1
'''simple docstring''' import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch fro...
9
'''simple docstring''' import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassifi...
9
1
'''simple docstring''' import logging import os import threading import time try: import warnings except ImportError: _UpperCAmelCase : Any = None try: import msvcrt except ImportError: _UpperCAmelCase : Any = None try: import fcntl except ImportError:...
9
'''simple docstring''' from __future__ import annotations import math def __magic_name__( lowerCamelCase, lowerCamelCase): if len(lowerCamelCase) != 2 or len(a[0]) != 2 or len(lowerCamelCase) != 2 or len(b[0]) != 2: raise Exception('''Matrices are not 2x2''') __lowerC...
9
1
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _UpperCAmelCase : Tuple = logging.get_logger(__n...
9
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import requ...
9
1
'''simple docstring''' from math import factorial def __magic_name__( lowerCamelCase = 1_0_0): return sum(int(lowerCamelCase) for x in str(factorial(lowerCamelCase))) if __name__ == "__main__": print(solution(int(input("""Enter the Number: """).strip())))
9
'''simple docstring''' 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 a__ ( _...
9
1
'''simple docstring''' from __future__ import annotations from typing import Any def __magic_name__( lowerCamelCase): if not postfix_notation: return 0 __lowerCAmelCase = {'''+''', '''-''', '''*''', '''/'''} __lowerCAmelCase = [] ...
9
'''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/L...
9
1
'''simple docstring''' import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def __magic_name__( *lowerCamelCase): if not isinstance(lowerCamelCase, lowerCamelCase): __lowerCAmelCase = list(lowerCamelC...
9
'''simple docstring''' def __magic_name__( lowerCamelCase): __lowerCAmelCase = 1 __lowerCAmelCase = 2 while i * i <= n: __lowerCAmelCase = 0 while n % i == 0: n //= i multiplicity +=...
9
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _UpperCAmelCase : List[str] = { """configuration_vision_encoder_decoder"""...
9
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class a__ ( unittest.TestCase ): ...
9
1
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _UpperCAmelCase : List[Any] = datasets.load_iris() _UpperCAmelCase : Dict = np.array(data["""data"""]) _UpperCA...
9
'''simple docstring''' from typing import Dict, Optional import numpy as np import datasets _UpperCAmelCase : List[str] = """ IoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union between the predicted segmentation and the gro...
9
1