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
import sys import turtle def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) -> Optional[int]: '''simple docstring''' return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase, _UpperCAmelCase, _UpperCAmel...
353
from __future__ import annotations from typing import Any class __A : def __init__( self : Optional[Any] , UpperCAmelCase_ : int ): lowerCAmelCase : Tuple = num_of_nodes lowerCAmelCase : list[list[int]] = [] ...
323
0
__A : Any = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(10_0000)] def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> int: '''simple docstring''' lowerCAmelCase : Optional[int] = 0 while number: # Increased Speed Slightly b...
354
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : List[Any] = { '''configuration_autoformer''': [ '''AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''AutoformerConfi...
323
0
def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase = 1_000_000 ) -> int: '''simple docstring''' lowerCAmelCase : Union[str, Any] = limit + 1 lowerCAmelCase : str = [0] * limit for first_term in range(1, _UpperCAmelCase ): for n in range(_U...
355
import math def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase = 100 ) -> int: '''simple docstring''' lowerCAmelCase : Any = sum(i * i for i in range(1, n + 1 ) ) lowerCAmelCase : str = int(math.pow(sum(range(1, n + 1 ) ), 2 ) ) return s...
323
0
import unittest from transformers import AutoTokenizer, FalconConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import Model...
356
from collections.abc import Sequence def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) -> float: '''simple docstring''' return sum(c * (x**i) for i, c in enumerate(_UpperCAmelCase ) ) def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) ...
323
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __A : Union[str, Any] = logging.get_logger(__name__) __A : Any = { '''google/realm-cc-news-pretrained-embedder''': ( '''https://huggingface.co/google/realm-cc-news-pretrained-embedde...
357
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import torch i...
323
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A : List[str] = logging.get_logger(__name__) __A : List[Any] = { ...
358
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) def ...
323
0
"""simple docstring""" import inspect import os import re from transformers.configuration_utils import PretrainedConfig from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config...
359
def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) -> int: '''simple docstring''' if len(_UpperCAmelCase ) != len(_UpperCAmelCase ): raise ValueError('String lengths must match!' ) lowerCAmelCase : Tuple = 0 for chara, chara in zi...
323
0
__A : Optional[Any] = { "a": "AAAAA", "b": "AAAAB", "c": "AAABA", "d": "AAABB", "e": "AABAA", "f": "AABAB", "g": "AABBA", "h": "AABBB", "i": "ABAAA", "j": "BBBAA", "k": "ABAAB", "l": "ABABA", "m": "ABABB", "n": "ABBAA", "o": "ABBAB", ...
360
import argparse import logging import os import time import timeit import datasets import numpy as np import pycuda.autoinit # noqa: F401 import pycuda.driver as cuda import tensorrt as trt import torch from absl import logging as absl_logging from accelerate import Accelerator from datasets import load_dataset, lo...
323
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available __A : int = { '''configuration_longt5''': ['''LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''LongT5Config''', '''LongT5OnnxConfig'''], } try: if not is_tor...
361
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __A : Any = logging.get_logger(__name__) __A : Union[str, Any] = { '''shi-labs/dinat-mini-...
323
0
from collections import deque from math import floor from random import random from time import time class __A : def __init__( self : List[str] ): lowerCAmelCase : Any = {} def lowercase__ ( self : Optional[int] , UpperCAmelCase...
362
from manim import * class __A ( lowerCAmelCase ): def lowercase__ ( self : Union[str, Any] ): lowerCAmelCase : Dict = Rectangle(height=0.5 , width=0.5 ) lowerCAmelCase : Any = Rectangle(height=0.46 , width=...
323
0
import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller __A : str = 3 def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> int: '''simple docstring''' print('Generating primitive root of p' ) while True: ...
363
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : Union[str, Any] = { '''configuration_informer''': [ '''INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''InformerConfi...
323
0
def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> list[int]: '''simple docstring''' if num <= 0: raise ValueError('Input must be a positive integer' ) lowerCAmelCase : List[str] = [True] * (num + 1) lowerCAmelCase : int = 2 whi...
364
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) __A : Dict = models.Sequential() # Step 1 - Convolution # ...
323
0
from __future__ import annotations def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) -> list[str]: '''simple docstring''' if partitions <= 0: raise ValueError('partitions must be a positive number!' ) if partitions > number_of_bytes: raise ValueEr...
365
import logging import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING, BertEncoder, ...
323
0
"""simple docstring""" import re def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> Union[str, Any]: '''simple docstring''' if len(re.findall('[ATCG]', lowerCAmelCase__ ) ) != len(lowerCAmelCase__ ): raise ValueError('Invalid Strand' ) return dna.translate(dn...
366
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTrainedTokenizerBase, TensorType __A ...
323
0
"""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, EfficientFormerForImageClassificationWithTeac...
367
__A : Dict = [ 999, 800, 799, 600, 599, 500, 400, 399, 377, 355, 333, 311, 288, 266, 244, 222, 200, 199, 177, 155, 133, 111, 88, 66, 44, 22, 0, ] __A : List[Any] = [ ...
323
0
from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
368
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __A : Optional[Any] = {'''configuration_unispeech''': ['''UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''UniSpeechCo...
323
0
import unittest from transformers import ( MODEL_FOR_OBJECT_DETECTION_MAPPING, AutoFeatureExtractor, AutoModelForObjectDetection, ObjectDetectionPipeline, is_vision_available, pipeline, ) from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_pytess...
369
from __future__ import annotations import unittest from transformers import RoFormerConfig, 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_mask from...
323
0
import gc import unittest from transformers import MODEL_FOR_MASKED_LM_MAPPING, TF_MODEL_FOR_MASKED_LM_MAPPING, FillMaskPipeline, pipeline from transformers.pipelines import PipelineException from transformers.testing_utils import ( is_pipeline_test, is_torch_available, nested_simplify, require_tf, ...
370
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 require_vision from transformers.utils import...
323
0
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
371
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A : List[Any] = { '''configuration_xlm_roberta'''...
323
0
from queue import PriorityQueue from typing import Any import numpy as np def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase, _UpperCAmelCase, _UpperCAmelCase, _UpperCAmelCase, _UpperCAmelCase, _UpperCAmelCase, _UpperCAmelCase, _UpperCAmelCase, ) -> Tuple: '''simple docstring''' ...
350
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available from .timesteps import ( fastaa_timesteps, smartaa_timesteps, smartaa_timesteps, sma...
323
0
import inspect import unittest from transformers import ViTMSNConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test_mod...
351
import unittest from transformers.testing_utils import CaptureStdout from transformers.tools.python_interpreter import evaluate def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> List[Any]: '''simple docstring''' return x + 2 class __A ( unittest.TestCase ): ...
323
0
"""simple docstring""" import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __A ( __lo...
352
from math import pi, sqrt, tan def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> float: '''simple docstring''' if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * side_length**2 def SCREAMING_SNAKE_CASE__ ( ...
323
0
import darl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline __A : List[str] = { """n_samples""": 64, """horizon""": 32, """num_inference_steps""": 20, """n_guide_steps""": 2, # can set to 0 for faster sampling, does not use value network ...
353
from __future__ import annotations from typing import Any class __A : def __init__( self : Optional[Any] , UpperCAmelCase_ : int ): lowerCAmelCase : Tuple = num_of_nodes lowerCAmelCase : list[list[int]] = [] ...
323
0
class __A ( lowercase_ ): pass class __A ( lowercase_ ): pass class __A : def __init__( self : Tuple ): lowerCAmelCase : List[str] = [ [], [], [], ] def lowercase_...
354
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : List[Any] = { '''configuration_autoformer''': [ '''AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''AutoformerConfi...
323
0
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 : Optional[int] = ...
355
import math def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase = 100 ) -> int: '''simple docstring''' lowerCAmelCase : Any = sum(i * i for i in range(1, n + 1 ) ) lowerCAmelCase : str = int(math.pow(sum(range(1, n + 1 ) ), 2 ) ) return s...
323
0
import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) __A : List[Any] = { 'sample_size': 32, 'in_channels': 3, 'out_channels': 3, 'layers_per_block': 2, 'num_class_embeds': 1000, ...
356
from collections.abc import Sequence def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) -> float: '''simple docstring''' return sum(c * (x**i) for i, c in enumerate(_UpperCAmelCase ) ) def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) ...
323
0
def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> str: '''simple docstring''' lowerCAmelCase : List[str] = 0 # if input_string is "aba" than new_input_string become "a|b|a" lowerCAmelCase : Optional[Any] = '' lowerCAmelCase : str ...
357
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import torch i...
323
0
from collections.abc import Sequence from queue import Queue class __A : def __init__( self : List[Any] , UpperCAmelCase_ : List[str] , UpperCAmelCase_ : Optional[Any] , UpperCAmelCase_ : Any , UpperCAmelCase_ : Any=Non...
358
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) def ...
323
0
"""simple docstring""" from collections.abc import Sequence def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase = None ) -> Union[str, Any]: '''simple docstring''' if nums is None or not nums: raise ValueError('Input sequence should not be empty' ) lowerCAmelCase : ...
359
def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) -> int: '''simple docstring''' if len(_UpperCAmelCase ) != len(_UpperCAmelCase ): raise ValueError('String lengths must match!' ) lowerCAmelCase : Tuple = 0 for chara, chara in zi...
323
0
import contextlib import csv import json import os import sqlitea import tarfile import textwrap import zipfile import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config @pytest.fixture(scope='session' ) def SCREAMING_SNAKE_CASE__ ( ) -> int: '''...
360
import argparse import logging import os import time import timeit import datasets import numpy as np import pycuda.autoinit # noqa: F401 import pycuda.driver as cuda import tensorrt as trt import torch from absl import logging as absl_logging from accelerate import Accelerator from datasets import load_dataset, lo...
323
0
import tempfile import unittest from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from transformers.testing_utils import ( is_torch_available, require_optimum, require_torch, slow, ) if is_torch_available(): import torch @require_torch @require_optimum @slow class __A ( ...
361
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __A : Any = logging.get_logger(__name__) __A : Union[str, Any] = { '''shi-labs/dinat-mini-...
323
0
def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ): '''simple docstring''' if isinstance(__snake_case, __snake_case ): raise TypeError('\'float\' object cannot be interpreted as an integer' ) if isinstance(__snake_case, __snake_case ): raise TypeError('\'str\' ob...
362
from manim import * class __A ( lowerCAmelCase ): def lowercase__ ( self : Union[str, Any] ): lowerCAmelCase : Dict = Rectangle(height=0.5 , width=0.5 ) lowerCAmelCase : Any = Rectangle(height=0.46 , width=...
323
0
import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": __A : int = pd.read_csv('''sample_data.csv''', header=None) __A : Dict ...
363
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : Union[str, Any] = { '''configuration_informer''': [ '''INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''InformerConfi...
323
0
import unittest from transformers import BigBirdTokenizer, BigBirdTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin __A : ...
364
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) __A : Dict = models.Sequential() # Step 1 - Convolution # ...
323
0
import darl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline __A : List[str] = { '''n_samples''': 64, '''horizon''': 32, '''num_inference_steps''': 20, '''n_guide_steps''': 2, # can set to 0 for faster sampling, does not use value network ...
365
import logging import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING, BertEncoder, ...
323
0
"""simple docstring""" from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase, _UpperCAmelCase, _UpperCAmelCase, _UpperCAmelCase ) -> np.ndarray: '''simple docstring''' lowerCAmel...
366
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTrainedTokenizerBase, TensorType __A ...
323
0
"""simple docstring""" import unittest import numpy as np from transformers import AlbertConfig, 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.num...
367
__A : Dict = [ 999, 800, 799, 600, 599, 500, 400, 399, 377, 355, 333, 311, 288, 266, 244, 222, 200, 199, 177, 155, 133, 111, 88, 66, 44, 22, 0, ] __A : List[Any] = [ ...
323
0
import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem __A : Any = importlib.util.find_spec('''s3fs''') is not None if _has_safs: from .safilesystem import SaFil...
368
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __A : Optional[Any] = {'''configuration_unispeech''': ['''UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''UniSpeechCo...
323
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available, ) __A : Any = { '''configuration_speecht5''': [ '''SPEECHT5_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''SPEECHT5_P...
369
from __future__ import annotations import unittest from transformers import RoFormerConfig, 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_mask from...
323
0
import qiskit def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) -> qiskit.result.counts.Counts: '''simple docstring''' lowerCAmelCase : Tuple = qiskit.Aer.get_backend('aer_simulator' ) lowerCAmelCase : Union[str, Any] = qiskit.Qua...
370
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 require_vision from transformers.utils import...
323
0
import inspect import unittest from typing import List import numpy as np from transformers import EfficientFormerConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_common impor...
371
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A : List[Any] = { '''configuration_xlm_roberta'''...
323
0
class __A : def __init__( self : Optional[int] , UpperCAmelCase_ : Union[str, Any] ): # we need a list not a string, so do something to change the type lowerCAmelCase : Optional[int] = arr.split(',' ) def lowercase__ ( se...
350
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available from .timesteps import ( fastaa_timesteps, smartaa_timesteps, smartaa_timesteps, sma...
323
0
import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all feature extractors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code from ...featu...
351
import unittest from transformers.testing_utils import CaptureStdout from transformers.tools.python_interpreter import evaluate def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> List[Any]: '''simple docstring''' return x + 2 class __A ( unittest.TestCase ): ...
323
0
"""simple docstring""" import argparse import gc import json import os 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 from a...
352
from math import pi, sqrt, tan def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> float: '''simple docstring''' if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * side_length**2 def SCREAMING_SNAKE_CASE__ ( ...
323
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_available(...
353
from __future__ import annotations from typing import Any class __A : def __init__( self : Optional[Any] , UpperCAmelCase_ : int ): lowerCAmelCase : Tuple = num_of_nodes lowerCAmelCase : list[list[int]] = [] ...
323
0
from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_available(): import torc...
354
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : List[Any] = { '''configuration_autoformer''': [ '''AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''AutoformerConfi...
323
0
__A : str = '''Tobias Carryer''' from time import time class __A : def __init__( self : int , UpperCAmelCase_ : Any , UpperCAmelCase_ : List[Any] , UpperCAmelCase_ : List[Any] , UpperCAmelCase_ : Union...
355
import math def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase = 100 ) -> int: '''simple docstring''' lowerCAmelCase : Any = sum(i * i for i in range(1, n + 1 ) ) lowerCAmelCase : str = int(math.pow(sum(range(1, n + 1 ) ), 2 ) ) return s...
323
0
from collections import defaultdict def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) -> bool: '''simple docstring''' lowerCAmelCase : Any = first_str.lower().strip() lowerCAmelCase : List[str] = second_str.lower().strip() # Rem...
356
from collections.abc import Sequence def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) -> float: '''simple docstring''' return sum(c * (x**i) for i, c in enumerate(_UpperCAmelCase ) ) def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) ...
323
0
# 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 ..controlnet.pipeline_controlnet impor...
357
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import torch i...
323
0
__A : Dict = [ 999, 800, 799, 600, 599, 500, 400, 399, 377, 355, 333, 311, 288, 266, 244, 222, 200, 199, 177, 155, 133, 111, 88, 66, 44, 22, 0, ] __A : List[Any] = [ ...
358
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) def ...
323
0
"""simple docstring""" import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ASTConfig from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_torchaudio_avai...
359
def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) -> int: '''simple docstring''' if len(_UpperCAmelCase ) != len(_UpperCAmelCase ): raise ValueError('String lengths must match!' ) lowerCAmelCase : Tuple = 0 for chara, chara in zi...
323
0
def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) -> list[int]: '''simple docstring''' lowerCAmelCase : Any = int(_UpperCAmelCase ) # Initialize Result lowerCAmelCase : Dict = [] # Traverse through all denomination fo...
360
import argparse import logging import os import time import timeit import datasets import numpy as np import pycuda.autoinit # noqa: F401 import pycuda.driver as cuda import tensorrt as trt import torch from absl import logging as absl_logging from accelerate import Accelerator from datasets import load_dataset, lo...
323
0
from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_i...
361
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __A : Any = logging.get_logger(__name__) __A : Union[str, Any] = { '''shi-labs/dinat-mini-...
323
0
from collections.abc import Iterable from typing import Generic, TypeVar __A : Optional[int] = TypeVar('''_T''') class __A ( Generic[_T] ): def __init__( self : Any , UpperCAmelCase_ : Iterable[_T] | None = None ): lowerCAmelCase ...
362
from manim import * class __A ( lowerCAmelCase ): def lowercase__ ( self : Union[str, Any] ): lowerCAmelCase : Dict = Rectangle(height=0.5 , width=0.5 ) lowerCAmelCase : Any = Rectangle(height=0.46 , width=...
323
0
from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. __A : Optional[Any] = 200 # Number of elements selected in every generation of evolution. The selection takes # place from best to worst of that generation and...
363
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : Union[str, Any] = { '''configuration_informer''': [ '''INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''InformerConfi...
323
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available __A : List[Any] = { '''configuration_longt5''': ['''LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''LongT5Config''', '''LongT5OnnxConfig'''], } try: if...
364
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) __A : Dict = models.Sequential() # Step 1 - Convolution # ...
323
0
import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class __A ( lowerCAmelCase ): lowerCAmelCase_ : Tuple = (CMStochasticIterativeScheduler,) lowerCAmelCase_ : List[Any] = 10 ...
365
import logging import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING, BertEncoder, ...
323
0
"""simple docstring""" import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import AdamW from torc...
366
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTrainedTokenizerBase, TensorType __A ...
323
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __A : Union[str, Any] = { '''configuration_biogpt''': ['''BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BioGptConfig'''], ...
367
__A : Dict = [ 999, 800, 799, 600, 599, 500, 400, 399, 377, 355, 333, 311, 288, 266, 244, 222, 200, 199, 177, 155, 133, 111, 88, 66, 44, 22, 0, ] __A : List[Any] = [ ...
323
0
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : Union[str, Any] = { '''configuration_informer''': [ '''INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''InformerConfi...
368
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __A : Optional[Any] = {'''configuration_unispeech''': ['''UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''UniSpeechCo...
323
0
import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common import TokenizerTester...
369
from __future__ import annotations import unittest from transformers import RoFormerConfig, 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_mask from...
323
0
import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.models.bert.configuration_bert import BertConfig from tra...
370
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 require_vision from transformers.utils import...
323
0
import gc import unittest from transformers import CTRLConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMix...
371
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A : List[Any] = { '''configuration_xlm_roberta'''...
323
0
from collections import defaultdict def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> int: '''simple docstring''' lowerCAmelCase : List[str] = 1 lowerCAmelCase : str = True for v in tree[start]: if v not in visited: ret += ...
350
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available from .timesteps import ( fastaa_timesteps, smartaa_timesteps, smartaa_timesteps, sma...
323
0
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 require_vision from transformers.utils import...
351
import unittest from transformers.testing_utils import CaptureStdout from transformers.tools.python_interpreter import evaluate def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> List[Any]: '''simple docstring''' return x + 2 class __A ( unittest.TestCase ): ...
323
0
"""simple docstring""" import argparse import requests import torch from PIL import Image from torchvision.transforms import Compose, Normalize, Resize, ToTensor from transformers import SwinaSRConfig, SwinaSRForImageSuperResolution, SwinaSRImageProcessor def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCa...
352
from math import pi, sqrt, tan def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> float: '''simple docstring''' if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * side_length**2 def SCREAMING_SNAKE_CASE__ ( ...
323
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A : Tuple = logging.get_logger(__name__) __A : str = { '''facebook/xlm-roberta-xl''': '''http...
353
from __future__ import annotations from typing import Any class __A : def __init__( self : Optional[Any] , UpperCAmelCase_ : int ): lowerCAmelCase : Tuple = num_of_nodes lowerCAmelCase : list[list[int]] = [] ...
323
0
from math import pi, sqrt, tan def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> float: '''simple docstring''' if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * side_length**2 def SCREAMING_SNAKE_CASE__ ( ...
354
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : List[Any] = { '''configuration_autoformer''': [ '''AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''AutoformerConfi...
323
0
from .testing import ( are_the_same_tensors, execute_subprocess_async, require_bnb, require_cpu, require_cuda, require_huggingface_suite, require_mps, require_multi_gpu, require_multi_xpu, require_safetensors, require_single_gpu, require_single_xpu, require_torch_mi...
355
import math def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase = 100 ) -> int: '''simple docstring''' lowerCAmelCase : Any = sum(i * i for i in range(1, n + 1 ) ) lowerCAmelCase : str = int(math.pow(sum(range(1, n + 1 ) ), 2 ) ) return s...
323
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) __A : Optional[int] = { '''configuration_trocr''': ['''TROCR_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''T...
356
from collections.abc import Sequence def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) -> float: '''simple docstring''' return sum(c * (x**i) for i, c in enumerate(_UpperCAmelCase ) ) def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) ...
323
0
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers imp...
357
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import torch i...
323
0
from manim import * class __A ( lowerCAmelCase ): def lowercase__ ( self : Union[str, Any] ): lowerCAmelCase : Dict = Rectangle(height=0.5 , width=0.5 ) lowerCAmelCase : Any = Rectangle(height=0.46 ,...
358
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) def ...
323
0
"""simple docstring""" import os import shutil import tempfile import unittest import numpy as np from transformers import AutoTokenizer, BarkProcessor from transformers.testing_utils import require_torch, slow @require_torch class __A ( unittest.TestCase ): def lowercase__ ( self...
359
def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) -> int: '''simple docstring''' if len(_UpperCAmelCase ) != len(_UpperCAmelCase ): raise ValueError('String lengths must match!' ) lowerCAmelCase : Tuple = 0 for chara, chara in zi...
323
0
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __A ( lowerCAmelCase ): """simple docstring...
360
import argparse import logging import os import time import timeit import datasets import numpy as np import pycuda.autoinit # noqa: F401 import pycuda.driver as cuda import tensorrt as trt import torch from absl import logging as absl_logging from accelerate import Accelerator from datasets import load_dataset, lo...
323
0
def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> int: '''simple docstring''' if not isinstance(_UpperCAmelCase, _UpperCAmelCase ): raise ValueError('multiplicative_persistence() only accepts integral values' ) if num < 0: raise ValueError('multiplicative_per...
361
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __A : Any = logging.get_logger(__name__) __A : Union[str, Any] = { '''shi-labs/dinat-mini-...
323
0
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ): '''simple docstring''' lowerCAmelCase : Tuple = f"{sampling_rate}" lowerCAmelCase : ...
362
from manim import * class __A ( lowerCAmelCase ): def lowercase__ ( self : Union[str, Any] ): lowerCAmelCase : Dict = Rectangle(height=0.5 , width=0.5 ) lowerCAmelCase : Any = Rectangle(height=0.46 , width=...
323
0
from math import ceil def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase = 1_001 ) -> int: '''simple docstring''' lowerCAmelCase : Optional[Any] = 1 for i in range(1, int(ceil(n / 2.0 ) ) ): lowerCAmelCase : str = 2 * i + 1 lowerC...
363
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : Union[str, Any] = { '''configuration_informer''': [ '''INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''InformerConfi...
323
0
import requests from bsa import BeautifulSoup def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) -> str: '''simple docstring''' lowerCAmelCase : int = BeautifulSoup(requests.get(_UpperCAmelCase, params=_UpperCAmelCase ).content, 'html.parser' ) l...
364
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) __A : Dict = models.Sequential() # Step 1 - Convolution # ...
323
0
import argparse import logging import os import time import timeit import datasets import numpy as np import pycuda.autoinit # noqa: F401 import pycuda.driver as cuda import tensorrt as trt import torch from absl import logging as absl_logging from accelerate import Accelerator from datasets import load_dataset, lo...
365
import logging import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING, BertEncoder, ...
323
0
"""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_tokenizers,...
366
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTrainedTokenizerBase, TensorType __A ...
323
0
"""simple docstring""" from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean __A : List[Any] = 0 __A : List[Any] = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [...
367
__A : Dict = [ 999, 800, 799, 600, 599, 500, 400, 399, 377, 355, 333, 311, 288, 266, 244, 222, 200, 199, 177, 155, 133, 111, 88, 66, 44, 22, 0, ] __A : List[Any] = [ ...
323
0
from ..utils import DummyObject, requires_backends class __A ( metaclass=lowerCAmelCase ): lowerCAmelCase_ : List[str] = ["torch"] def __init__( self : Tuple , *UpperCAmelCase_ : Any , **UpperCAmelCase_ : Optional[int] ...
368
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __A : Optional[Any] = {'''configuration_unispeech''': ['''UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''UniSpeechCo...
323
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A : List[str] = {'''configuration_mbart''': ['''MB...
369
from __future__ import annotations import unittest from transformers import RoFormerConfig, 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_mask from...
323
0
import copy import os from typing import TYPE_CHECKING, List, Union if TYPE_CHECKING: pass from ...configuration_utils import PretrainedConfig from ...utils import logging __A : List[Any] = logging.get_logger(__name__) __A : Tuple = { '''kakaobrain/align-base''': '''...
370
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 require_vision from transformers.utils import...
323
0
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 ( AutoProcessor, BertTokenizerFast, BlipI...
371
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A : List[Any] = { '''configuration_xlm_roberta'''...
323
0
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...schedulers import HeunDiscreteScheduler from .....
350
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available from .timesteps import ( fastaa_timesteps, smartaa_timesteps, smartaa_timesteps, sma...
323
0
from __future__ import annotations import math def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ): '''simple docstring''' if num <= 0: lowerCAmelCase : List[str] = f"{num}: Invalid input, please enter a positive integer." raise ValueError(_UpperCAmelCase ...
351
import unittest from transformers.testing_utils import CaptureStdout from transformers.tools.python_interpreter import evaluate def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> List[Any]: '''simple docstring''' return x + 2 class __A ( unittest.TestCase ): ...
323
0
"""simple docstring""" from collections.abc import Sequence def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) -> float: '''simple docstring''' return sum(c * (x**i) for i, c in enumerate(_UpperCAmelCase ) ) def SCREAMING_SNAKE_CASE__ ( _UpperCAmel...
352
from math import pi, sqrt, tan def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> float: '''simple docstring''' if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * side_length**2 def SCREAMING_SNAKE_CASE__ ( ...
323
0
import flax.linen as nn import jax.numpy as jnp from .attention_flax import FlaxTransformeraDModel from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD class __A ( nn.Module ): lowerCAmelCase_ : int lowerCAmelCase_ : int lowerCAmelCase_ ...
353
from __future__ import annotations from typing import Any class __A : def __init__( self : Optional[Any] , UpperCAmelCase_ : int ): lowerCAmelCase : Tuple = num_of_nodes lowerCAmelCase : list[list[int]] = [] ...
323
0
from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.config import PatchingSpec from ...tokenization_util...
354
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : List[Any] = { '''configuration_autoformer''': [ '''AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''AutoformerConfi...
323
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 ...image_util...
355
import math def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase = 100 ) -> int: '''simple docstring''' lowerCAmelCase : Any = sum(i * i for i in range(1, n + 1 ) ) lowerCAmelCase : str = int(math.pow(sum(range(1, n + 1 ) ), 2 ) ) return s...
323
0
import tempfile import unittest import numpy as np import transformers from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow from ...generation.test_flax_utils import FlaxGenerationTesterMixin fr...
356
from collections.abc import Sequence def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) -> float: '''simple docstring''' return sum(c * (x**i) for i, c in enumerate(_UpperCAmelCase ) ) def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) ...
323
0
import mpmath # for roots of unity import numpy as np class __A : def __init__( self : Optional[int] , UpperCAmelCase_ : Dict=None , UpperCAmelCase_ : str=None ): # Input as list lowerCAmelCase : str = list(poly_a or...
357
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import torch i...
323
0
import unittest from transformers import AlbertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, r...
358
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) def ...
323
0
"""simple docstring""" import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets __A : Optional[Any] = datasets.logging.get_logger(__name__) __A : Tuple = '''\ @inproceedings{bleurt, title={BLEURT: Learning Robust ...
359
def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) -> int: '''simple docstring''' if len(_UpperCAmelCase ) != len(_UpperCAmelCase ): raise ValueError('String lengths must match!' ) lowerCAmelCase : Tuple = 0 for chara, chara in zi...
323
0
# Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING, Dict, Optional import numpy as np import pyarrow as pa from .. import config from ..utils.logging import get_logger from ..utils.py_utils import map_nested from .formatting import TensorFormatter if TYPE_CHECKING: ...
360
import argparse import logging import os import time import timeit import datasets import numpy as np import pycuda.autoinit # noqa: F401 import pycuda.driver as cuda import tensorrt as trt import torch from absl import logging as absl_logging from accelerate import Accelerator from datasets import load_dataset, lo...
323
0
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> Optional[Any]: '''simple docstring''' lowerCAmelCase : Optional[int] = os.path.join(ar...
361
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __A : Any = logging.get_logger(__name__) __A : Union[str, Any] = { '''shi-labs/dinat-mini-...
323
0
import flax.linen as nn import jax import jax.numpy as jnp class __A ( nn.Module ): lowerCAmelCase_ : int lowerCAmelCase_ : jnp.dtype = jnp.floataa def lowercase__ ( self : int ): lowerCAmelCase : List[Any] ...
362
from manim import * class __A ( lowerCAmelCase ): def lowercase__ ( self : Union[str, Any] ): lowerCAmelCase : Dict = Rectangle(height=0.5 , width=0.5 ) lowerCAmelCase : Any = Rectangle(height=0.46 , width=...
323
0
import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __A : Optional[Any] = logging.get_logger(__name__) __A : Any = { '''vocab_file''': '''vocab.json''', '''tokenizer...
363
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : Union[str, Any] = { '''configuration_informer''': [ '''INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''InformerConfi...
323
0
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : List[Any] = { '''configuration_autoformer''': [ '''AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''AutoformerConfi...
364
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) __A : Dict = models.Sequential() # Step 1 - Convolution # ...
323
0