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 snake_case__ ( __lowerCamelCase : int ): """simple docstring""" if n == 1 or not isinstance(__lowerCamelCase , __lowerCamelCase ): return 0 elif n == 2: return 1 else: lowerCamelCase__ : Optional[Any] =[0, 1] ...
272
"""simple docstring""" import math import flax.linen as nn import jax.numpy as jnp def snake_case__ ( __lowerCamelCase : jnp.ndarray , __lowerCamelCase : int , __lowerCamelCase : float = 1 , __lowerCamelCase : float = 1 , __lowerCamelCase :...
272
1
"""simple docstring""" class __SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__( self : Optional[Any] )-> Tuple: lowerCamelCase__ : str ={} def snake_case ( self : Union[str, Any] )-> None: print(self.vertex ) ...
272
"""simple docstring""" import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as...
272
1
"""simple docstring""" import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowercase : str = logging.get_logger(__name__) _lowercase : List[str] = {...
272
"""simple docstring""" from collections import defaultdict class __SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__( self : Union[str, Any], lowerCamelCase : List[Any], lowerCamelCase : List[str] )-> Optional[int]: lowerCamelCase__ : List[A...
272
1
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __SCREAMING_SNAKE_CASE ( lowerCAmelCase_ ): '''simple docstring''' _a = ['image_processor', 'tokenizer'] _a ...
272
"""simple docstring""" import argparse import torch from transformers import YosoConfig, YosoForMaskedLM def snake_case__ ( __lowerCamelCase : str ): """simple docstring""" if "model" in orig_key: lowerCamelCase__ : Optional[int] =orig_key.replace('''model.''' ...
272
1
"""simple docstring""" import os from collections import deque import torch from torch.utils.data import Dataset class __SCREAMING_SNAKE_CASE ( lowerCAmelCase_ ): '''simple docstring''' def __init__( self : List[Any], lowerCamelCase : Dict="", lowerCamelCase ...
272
"""simple docstring""" # Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the config ...
272
1
"""simple docstring""" from dataclasses import dataclass, field from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import pyarrow as pa if TYPE_CHECKING: from .features import FeatureType @dataclass class __SCREAMING_SNAKE_CASE : '''simple docstring''' _a ...
272
"""simple docstring""" from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeq...
272
1
"""simple docstring""" # Copyright (c) 2021-, NVIDIA CORPORATION. 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/LICENS...
272
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int ): """simple docstring""" lowerCamelCase__ : List[Any] =[0] * len(__lowerCamelCase ) lowerCamelCase__ : List[Any] =[] lowerCamelCase__ : List[Any] =[1] * len(__lowerCamelCase ) ...
272
1
"""simple docstring""" import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Optional[int] = logging.get_logger(__name__) _lowercase : int = { "RUCAIBox/mvp": "https://huggingface.co/RUCAIBox/mvp/resolve/main/c...
272
"""simple docstring""" # Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def snake_case__ ( __lowerCamelCase : Union[str, Any] , __lowerCamelCase : int , __lowerCamelCase : Tuple , __lowerCamelCase : Union[str, Any] ): ...
272
1
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, requir...
272
"""simple docstring""" from __future__ import annotations def snake_case__ ( __lowerCamelCase : str , __lowerCamelCase : list[str] | None = None ): """simple docstring""" lowerCamelCase__ : List[Any] =word_bank or [] # create a table lowerCamelCase__ ...
272
1
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int = 2000000 ): """simple docstring""" lowerCamelCase__ : Dict =[0 for i in range(n + 1 )] lowerCamelCase__ : List[Any] =1 lowerCamelCase__ : Dict =1 for i in range(2 , int(n**...
272
"""simple docstring""" import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device _lowercase : Tuple = False class __SCREAMING_SNAKE_CASE ...
272
1
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int , __lowerCamelCase : int ): """simple docstring""" while a != 0: lowerCamelCase__ , lowerCamelCase__ : Union[str, Any] =b % a, a return b def snake_case__ ( __lo...
272
"""simple docstring""" import os from collections import deque import torch from torch.utils.data import Dataset class __SCREAMING_SNAKE_CASE ( lowerCAmelCase_ ): '''simple docstring''' def __init__( self : List[Any], lowerCamelCase : Dict="", lowerCamelCase ...
272
1
"""simple docstring""" from string import ascii_lowercase, ascii_uppercase def snake_case__ ( __lowerCamelCase : str ): """simple docstring""" if not sentence: return "" lowerCamelCase__ : Any =dict(zip(__lowerCamelCase , __lowerCamelCase ) ) ...
272
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int , __lowerCamelCase : int ): """simple docstring""" return int((input_a, input_a).count(0 ) != 0 ) def snake_case__ ( ): """simple docstring""" assert nand_gate(0 , 0 ...
272
1
"""simple docstring""" from __future__ import annotations from typing import Dict from ...configuration_utils import PretrainedConfig _lowercase : Dict = { "susnato/ernie-m-base_pytorch": "https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/config.json", "susnato/ernie-...
272
"""simple docstring""" import numpy as np import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel from ...utils import logging _lowercase : int = logging.get_logger(__name__) class __SCREAMING_SNAKE_CASE ( lowerCAmelC...
272
1
"""simple docstring""" from collections import namedtuple _lowercase : Dict = namedtuple("from_to", "from_ to") _lowercase : List[Any] = { "cubicmeter": from_to(1, 1), "litre": from_to(0.001, 1_0_0_0), "kilolitre": from_to(1, 1), "gallon": from_to(0.00_454...
272
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) _lowercase : Any = { "configuration_trocr": ["TROCR_PRETRAINED_CONFIG_...
272
1
"""simple docstring""" _lowercase : List[Any] = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _lowercase : str = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _lowercase : Optional[Any] = { 0: "Sunday", 1: "Monday", 2: "Tuesday", 3: "Wednesday", 4: "Thur...
272
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings _lowercase : Tuple = r"\n [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and\n can be use...
272
1
"""simple docstring""" import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer _lowercase : Tuple = ...
272
"""simple docstring""" from ..utils import DummyObject, requires_backends class __SCREAMING_SNAKE_CASE ( metaclass=lowerCAmelCase_ ): '''simple docstring''' _a = ['torch', 'torchsde'] def __init__( self : Union[str, Any], *lowerCamelCase ...
272
1
"""simple docstring""" def snake_case__ ( __lowerCamelCase : list ): """simple docstring""" lowerCamelCase__ : Dict =len(__lowerCamelCase ) for _ in range(__lowerCamelCase ): for i in range(_ % 2 , arr_size - 1 , 2 ): if arr[i + 1]...
272
"""simple docstring""" from typing import List import jiwer import jiwer.transforms as tr from packaging import version import datasets from datasets.config import PY_VERSION if PY_VERSION < version.parse("3.8"): import importlib_metadata else: import importlib.metadata as importlib_metadata _lowerc...
272
1
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int ): """simple docstring""" if length <= 0 or not isinstance(__lowerCamelCase , __lowerCamelCase ): raise ValueError('''Length must be a positive integer.''' ) return [n * (2 * n - 1) for n in ra...
272
"""simple docstring""" from ...processing_utils import ProcessorMixin class __SCREAMING_SNAKE_CASE ( lowerCAmelCase_ ): '''simple docstring''' _a = 'SpeechT5FeatureExtractor' _a = 'SpeechT5Tokenizer' def __init__( self : D...
272
1
"""simple docstring""" import argparse import json import os import torch from transformers.file_utils import has_file from diffusers import UNetaDConditionModel, UNetaDModel _lowercase : Dict = False _lowercase : str = True _lowercase : str = False ...
272
"""simple docstring""" from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging _lowercase : List[str] = logging.get_logger(__name__) def snake_case__ ( __lowerCamelCase : Union[tf.Tensor, np.ndarray] ): ...
272
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import ( Dif...
272
"""simple docstring""" import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, init_empty_weight...
272
1
"""simple docstring""" import pickle import numpy as np from matplotlib import pyplot as plt class __SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__( self : Optional[Any], lowerCamelCase : List[Any], lowerCamelCase : str, lowerCamelCase : Tuple...
272
"""simple docstring""" from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, ran...
272
1
"""simple docstring""" import functools def snake_case__ ( __lowerCamelCase : list[int] , __lowerCamelCase : list[int] ): """simple docstring""" # Validation if not isinstance(__lowerCamelCase , __lowerCamelCase ) or not all(isinstance(__lowerCamelCa...
272
"""simple docstring""" import numpy as np from PIL import Image def snake_case__ ( __lowerCamelCase : np.ndarray , __lowerCamelCase : int , __lowerCamelCase : int ): """simple docstring""" lowerCamelCase__ : List[Any] =np.array(__lowerCamelCase ...
272
1
"""simple docstring""" from collections import defaultdict from math import ceil, sqrt def snake_case__ ( __lowerCamelCase : int = 1000000 , __lowerCamelCase : int = 10 ): """simple docstring""" lowerCamelCase__ : defaultdict =defaultdict(__lowerCamelCase ...
272
"""simple docstring""" import math import flax.linen as nn import jax.numpy as jnp def snake_case__ ( __lowerCamelCase : jnp.ndarray , __lowerCamelCase : int , __lowerCamelCase : float = 1 , __lowerCamelCase : float = 1 , __lowerCamelCase :...
272
1
"""simple docstring""" from ...utils import logging from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel from .configuration_mta import MTaConfig _lowercase : str = logging.get_logger(__name__) _lowercase : List[str] = "T5Config" cla...
272
"""simple docstring""" import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as...
272
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_deformable_detr import DeformableDetrImageProcessor _lowercase : List[str] = logging.get_logger(__name__) class __SCREAMING_SNAKE_CASE ( lowerCAmelCase_ ): '''simple docstring'...
272
"""simple docstring""" from collections import defaultdict class __SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__( self : Union[str, Any], lowerCamelCase : List[Any], lowerCamelCase : List[str] )-> Optional[int]: lowerCamelCase__ : List[A...
272
1
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int = 1000 ): """simple docstring""" lowerCamelCase__ : int =3 lowerCamelCase__ : Tuple =0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 15 == 0: result ...
272
"""simple docstring""" import argparse import torch from transformers import YosoConfig, YosoForMaskedLM def snake_case__ ( __lowerCamelCase : str ): """simple docstring""" if "model" in orig_key: lowerCamelCase__ : Optional[int] =orig_key.replace('''model.''' ...
272
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowercase : Union[str, Any] = { "configuration_roc_bert": ["ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "RoCBertConfig"],...
272
"""simple docstring""" # Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the config ...
272
1
"""simple docstring""" import copy import os import cva import numpy as np from matplotlib import pyplot as plt class __SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__( self : List[Any] )-> Union[str, Any]: lowerCamelCase__ : Any ='''''' lo...
272
"""simple docstring""" from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeq...
272
1
"""simple docstring""" import sys import webbrowser import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": print("Googling.....") _lowercase : Any = "https://www.google.com/search?q=" + " ".join(sys.argv[1:]) _lowercase : Opt...
272
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int ): """simple docstring""" lowerCamelCase__ : List[Any] =[0] * len(__lowerCamelCase ) lowerCamelCase__ : List[Any] =[] lowerCamelCase__ : List[Any] =[1] * len(__lowerCamelCase ) ...
272
1
"""simple docstring""" import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class __SCREAMING_SNAKE_CASE ( lowerCAmelCase_ ): '''simple docstring''' def __init__( self : ...
272
"""simple docstring""" # Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def snake_case__ ( __lowerCamelCase : Union[str, Any] , __lowerCamelCase : int , __lowerCamelCase : Tuple , __lowerCamelCase : Union[str, Any] ): ...
272
1
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( ...
272
"""simple docstring""" from __future__ import annotations def snake_case__ ( __lowerCamelCase : str , __lowerCamelCase : list[str] | None = None ): """simple docstring""" lowerCamelCase__ : List[Any] =word_bank or [] # create a table lowerCamelCase__ ...
272
1
"""simple docstring""" import numpy as np import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel from ...utils import logging _lowercase : int = logging.get_logger(__name__) class __SCREAMING_SNAKE_CASE ( lowerCAmelC...
272
"""simple docstring""" import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device _lowercase : Tuple = False class __SCREAMING_SNAKE_CASE ...
272
1
"""simple docstring""" from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageInput, make_list_of_...
272
"""simple docstring""" import os from collections import deque import torch from torch.utils.data import Dataset class __SCREAMING_SNAKE_CASE ( lowerCAmelCase_ ): '''simple docstring''' def __init__( self : List[Any], lowerCamelCase : Dict="", lowerCamelCase ...
272
1
"""simple docstring""" from __future__ import annotations import unittest import numpy as np from transformers import LayoutLMConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModel...
272
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int , __lowerCamelCase : int ): """simple docstring""" return int((input_a, input_a).count(0 ) != 0 ) def snake_case__ ( ): """simple docstring""" assert nand_gate(0 , 0 ...
272
1
"""simple docstring""" import unittest from transformers import MraConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor, random...
272
"""simple docstring""" import numpy as np import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel from ...utils import logging _lowercase : int = logging.get_logger(__name__) class __SCREAMING_SNAKE_CASE ( lowerCAmelC...
272
1
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...
272
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) _lowercase : Any = { "configuration_trocr": ["TROCR_PRETRAINED_CONFIG_...
272
1
"""simple docstring""" from typing import Any, Dict, Optional import torch import torch.nn.functional as F from torch import nn from ..utils import maybe_allow_in_graph from .activations import get_activation from .attention_processor import Attention from .embeddings import CombinedTimestepLabelEmbeddings ...
272
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings _lowercase : Tuple = r"\n [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and\n can be use...
272
1
"""simple docstring""" import os import pytest from attr import dataclass _lowercase : Tuple = "us-east-1" # defaults region @dataclass class __SCREAMING_SNAKE_CASE : '''simple docstring''' _a = 42 _a = 'arn:aws:iam::5581051...
272
"""simple docstring""" from ..utils import DummyObject, requires_backends class __SCREAMING_SNAKE_CASE ( metaclass=lowerCAmelCase_ ): '''simple docstring''' _a = ['torch', 'torchsde'] def __init__( self : Union[str, Any], *lowerCamelCase ...
272
1
"""simple docstring""" import json import os import unittest from transformers import BatchEncoding, MvpTokenizer, MvpTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils i...
272
"""simple docstring""" from typing import List import jiwer import jiwer.transforms as tr from packaging import version import datasets from datasets.config import PY_VERSION if PY_VERSION < version.parse("3.8"): import importlib_metadata else: import importlib.metadata as importlib_metadata _lowerc...
272
1
"""simple docstring""" import json import os import tempfile from unittest.mock import patch import torch from torch.utils.data import DataLoader, TensorDataset from accelerate import DistributedType, infer_auto_device_map, init_empty_weights from accelerate.accelerator import Accelerator from accelerate.st...
272
"""simple docstring""" from ...processing_utils import ProcessorMixin class __SCREAMING_SNAKE_CASE ( lowerCAmelCase_ ): '''simple docstring''' _a = 'SpeechT5FeatureExtractor' _a = 'SpeechT5Tokenizer' def __init__( self : D...
272
1
"""simple docstring""" from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAv...
272
"""simple docstring""" from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging _lowercase : List[str] = logging.get_logger(__name__) def snake_case__ ( __lowerCamelCase : Union[tf.Tensor, np.ndarray] ): ...
272
1
"""simple docstring""" import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, Wava...
272
"""simple docstring""" import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, init_empty_weight...
272
1
"""simple docstring""" from typing import Callable, List, Optional, Tuple, Union import torch from transformers import CLIPTextModel, CLIPTokenizer from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin, TransformeraDModel, VQModel from ...schedulers import VQDif...
272
"""simple docstring""" from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, ran...
272
1
"""simple docstring""" import qiskit def snake_case__ ( __lowerCamelCase : int , __lowerCamelCase : int ): """simple docstring""" lowerCamelCase__ : Any =qiskit.Aer.get_backend('''aer_simulator''' ) # Create a Quantum Circuit acting on the q registe...
272
"""simple docstring""" import numpy as np from PIL import Image def snake_case__ ( __lowerCamelCase : np.ndarray , __lowerCamelCase : int , __lowerCamelCase : int ): """simple docstring""" lowerCamelCase__ : List[Any] =np.array(__lowerCamelCase ...
272
1
"""simple docstring""" import argparse import os import gluonnlp as nlp import mxnet as mx import numpy as np import torch from gluonnlp.base import get_home_dir from gluonnlp.model.bert import BERTEncoder from gluonnlp.model.utils import _load_vocab from gluonnlp.vocab import Vocab from packaging import ver...
272
"""simple docstring""" import math import flax.linen as nn import jax.numpy as jnp def snake_case__ ( __lowerCamelCase : jnp.ndarray , __lowerCamelCase : int , __lowerCamelCase : float = 1 , __lowerCamelCase : float = 1 , __lowerCamelCase :...
272
1
"""simple docstring""" from __future__ import annotations def snake_case__ ( __lowerCamelCase : int ): """simple docstring""" lowerCamelCase__ : Optional[int] =[True] * limit lowerCamelCase__ : Any =False lowerCamelCase__ : Tuple =False lowerCa...
272
"""simple docstring""" import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as...
272
1
"""simple docstring""" import argparse import os import torch from transformers import FlavaImageCodebook, FlavaImageCodebookConfig def snake_case__ ( __lowerCamelCase : List[Any] , __lowerCamelCase : Any , __lowerCamelCase : Optional[Any] , __lowerCamel...
272
"""simple docstring""" from collections import defaultdict class __SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__( self : Union[str, Any], lowerCamelCase : List[Any], lowerCamelCase : List[str] )-> Optional[int]: lowerCamelCase__ : List[A...
272
1
"""simple docstring""" import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, init_empty_weight...
272
"""simple docstring""" import argparse import torch from transformers import YosoConfig, YosoForMaskedLM def snake_case__ ( __lowerCamelCase : str ): """simple docstring""" if "model" in orig_key: lowerCamelCase__ : Optional[int] =orig_key.replace('''model.''' ...
272
1
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class __SCREAMING_SNAKE_CASE ( lowerCAmelCase_ , lowerCAmelCase_ ): '''s...
272
"""simple docstring""" # Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the config ...
272
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 from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_feat...
272
"""simple docstring""" from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeq...
272
1
"""simple docstring""" from math import pi def snake_case__ ( __lowerCamelCase : int , __lowerCamelCase : int ): """simple docstring""" return 2 * pi * radius * (angle / 360) if __name__ == "__main__": print(arc_length(9_0, 1_0))
272
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int ): """simple docstring""" lowerCamelCase__ : List[Any] =[0] * len(__lowerCamelCase ) lowerCamelCase__ : List[Any] =[] lowerCamelCase__ : List[Any] =[1] * len(__lowerCamelCase ) ...
272
1
"""simple docstring""" from __future__ import annotations import math def snake_case__ ( __lowerCamelCase : int ): """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negativ...
272
"""simple docstring""" # Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def snake_case__ ( __lowerCamelCase : Union[str, Any] , __lowerCamelCase : int , __lowerCamelCase : Tuple , __lowerCamelCase : Union[str, Any] ): ...
272
1
"""simple docstring""" import os import pytest from transformers.dynamic_module_utils import get_imports _lowercase : Optional[int] = "\nimport os\n" _lowercase : Optional[Any] = "\ndef foo():\n import os\n return False\n" _lowercase : int = "\...
272
"""simple docstring""" from __future__ import annotations def snake_case__ ( __lowerCamelCase : str , __lowerCamelCase : list[str] | None = None ): """simple docstring""" lowerCamelCase__ : List[Any] =word_bank or [] # create a table lowerCamelCase__ ...
272
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, ran...
272
"""simple docstring""" import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device _lowercase : Tuple = False class __SCREAMING_SNAKE_CASE ...
272
1
"""simple docstring""" from __future__ import annotations def snake_case__ ( __lowerCamelCase : list , __lowerCamelCase : int ): """simple docstring""" # Checks if the entire collection has been sorted if len(__lowerCamelCase ) <= 1 or n <= 1: return ...
272
"""simple docstring""" import os from collections import deque import torch from torch.utils.data import Dataset class __SCREAMING_SNAKE_CASE ( lowerCAmelCase_ ): '''simple docstring''' def __init__( self : List[Any], lowerCamelCase : Dict="", lowerCamelCase ...
272
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 _lowercase : Optional[Any] = logging.get_logger(__name__) _...
272
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int , __lowerCamelCase : int ): """simple docstring""" return int((input_a, input_a).count(0 ) != 0 ) def snake_case__ ( ): """simple docstring""" assert nand_gate(0 , 0 ...
272
1
"""simple docstring""" class __SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__( self : Union[str, Any], lowerCamelCase : Dict, lowerCamelCase : Any )-> Union[str, Any]: lowerCamelCase__ : Union[str, Any] =name lowerCamelCase__...
272
"""simple docstring""" import numpy as np import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel from ...utils import logging _lowercase : int = logging.get_logger(__name__) class __SCREAMING_SNAKE_CASE ( lowerCAmelC...
272
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteSchedul...
272
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) _lowercase : Any = { "configuration_trocr": ["TROCR_PRETRAINED_CONFIG_...
272
1
"""simple docstring""" import numpy as np from PIL import Image def snake_case__ ( __lowerCamelCase : np.ndarray , __lowerCamelCase : int , __lowerCamelCase : int ): """simple docstring""" lowerCamelCase__ : List[Any] =np.array(__lowerCamelCase ...
272
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings _lowercase : Tuple = r"\n [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and\n can be use...
272
1
"""simple docstring""" import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer _lowercase : Tuple = logging.getLogger(__name__) def snake_case__ ( ): """simple docstring""" lowerCamelCase__ : Any ...
272
"""simple docstring""" from ..utils import DummyObject, requires_backends class __SCREAMING_SNAKE_CASE ( metaclass=lowerCAmelCase_ ): '''simple docstring''' _a = ['torch', 'torchsde'] def __init__( self : Union[str, Any], *lowerCamelCase ...
272
1
"""simple docstring""" import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipelin...
272
"""simple docstring""" from typing import List import jiwer import jiwer.transforms as tr from packaging import version import datasets from datasets.config import PY_VERSION if PY_VERSION < version.parse("3.8"): import importlib_metadata else: import importlib.metadata as importlib_metadata _lowerc...
272
1
"""simple docstring""" from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _lowercase : Tuple = datasets.load_iris() _lowercase : Any = np.array(data["data"]) _lowercase : Tuple ...
272
"""simple docstring""" from ...processing_utils import ProcessorMixin class __SCREAMING_SNAKE_CASE ( lowerCAmelCase_ ): '''simple docstring''' _a = 'SpeechT5FeatureExtractor' _a = 'SpeechT5Tokenizer' def __init__( self : D...
272
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Tuple = logging.get_logger(__name__) _lowercase : Any = { "facebook/s2t-wav2vec2-large-en-de": ( "https://huggingface.co/facebook/s2t-wav2vec2...
272
"""simple docstring""" from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging _lowercase : List[str] = logging.get_logger(__name__) def snake_case__ ( __lowerCamelCase : Union[tf.Tensor, np.ndarray] ): ...
272
1
"""simple docstring""" from jiwer import compute_measures import datasets _lowercase : Dict = "\\n@inproceedings{inproceedings,\n author = {Morris, Andrew and Maier, Viktoria and Green, Phil},\n year = {2004},\n month = {01},\n pages = {},\n title = {From WER and RIL to MER...
272
"""simple docstring""" import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, init_empty_weight...
272
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, loa...
272
"""simple docstring""" from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, ran...
272
1
"""simple docstring""" from __future__ import annotations def snake_case__ ( __lowerCamelCase : list , __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : int ): """simple docstring""" lowerCamelCase__ : Optional[int] ...
272
"""simple docstring""" import numpy as np from PIL import Image def snake_case__ ( __lowerCamelCase : np.ndarray , __lowerCamelCase : int , __lowerCamelCase : int ): """simple docstring""" lowerCamelCase__ : List[Any] =np.array(__lowerCamelCase ...
272
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 import Mod...
272
"""simple docstring""" import math import flax.linen as nn import jax.numpy as jnp def snake_case__ ( __lowerCamelCase : jnp.ndarray , __lowerCamelCase : int , __lowerCamelCase : float = 1 , __lowerCamelCase : float = 1 , __lowerCamelCase :...
272
1
"""simple docstring""" import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArg...
272
"""simple docstring""" import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as...
272
1
"""simple docstring""" from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeq...
272
"""simple docstring""" from collections import defaultdict class __SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__( self : Union[str, Any], lowerCamelCase : List[Any], lowerCamelCase : List[str] )-> Optional[int]: lowerCamelCase__ : List[A...
272
1
"""simple docstring""" import math _lowercase : List[str] = 1_0 _lowercase : List[Any] = 7 _lowercase : List[Any] = BALLS_PER_COLOUR * NUM_COLOURS def snake_case__ ( __lowerCamelCase : int = 20 ): """simple docstring""" lo...
272
"""simple docstring""" import argparse import torch from transformers import YosoConfig, YosoForMaskedLM def snake_case__ ( __lowerCamelCase : str ): """simple docstring""" if "model" in orig_key: lowerCamelCase__ : Optional[int] =orig_key.replace('''model.''' ...
272
1
"""simple docstring""" from __future__ import annotations def snake_case__ ( __lowerCamelCase : list[int] , __lowerCamelCase : int ): """simple docstring""" lowerCamelCase__ : List[str] =0 lowerCamelCase__ : int =len(__lowerCamelCase ) - 1 ...
272
"""simple docstring""" # Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the config ...
272
1
"""simple docstring""" 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 impor...
272
"""simple docstring""" from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeq...
272
1
"""simple docstring""" import collections import os import re from pathlib import Path _lowercase : int = "src/transformers" # Matches is_xxx_available() _lowercase : str = re.compile(r"is\_([a-z_]*)_available()") # Catches a one-line _import_struct = {xxx} _lowercase ...
272
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int ): """simple docstring""" lowerCamelCase__ : List[Any] =[0] * len(__lowerCamelCase ) lowerCamelCase__ : List[Any] =[] lowerCamelCase__ : List[Any] =[1] * len(__lowerCamelCase ) ...
272
1
"""simple docstring""" from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np from deco...
272
"""simple docstring""" # Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def snake_case__ ( __lowerCamelCase : Union[str, Any] , __lowerCamelCase : int , __lowerCamelCase : Tuple , __lowerCamelCase : Union[str, Any] ): ...
272
1
"""simple docstring""" from math import sqrt def snake_case__ ( __lowerCamelCase : int = 1000000 ): """simple docstring""" lowerCamelCase__ : int =0 lowerCamelCase__ : int =0 lowerCamelCase__ : int while num_cuboids <= limit: max_cuboid_size +...
272
"""simple docstring""" from __future__ import annotations def snake_case__ ( __lowerCamelCase : str , __lowerCamelCase : list[str] | None = None ): """simple docstring""" lowerCamelCase__ : List[Any] =word_bank or [] # create a table lowerCamelCase__ ...
272
1
"""simple docstring""" import unittest import numpy as np from transformers.file_utils import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is...
272
"""simple docstring""" import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device _lowercase : Tuple = False class __SCREAMING_SNAKE_CASE ...
272
1
"""simple docstring""" import math from typing import Any, Callable, List, Optional, Tuple, Union import numpy as np import torch from ...models import TaFilmDecoder from ...schedulers import DDPMScheduler from ...utils import is_onnx_available, logging, randn_tensor if is_onnx_available(): from ..onnx_...
272
"""simple docstring""" import os from collections import deque import torch from torch.utils.data import Dataset class __SCREAMING_SNAKE_CASE ( lowerCAmelCase_ ): '''simple docstring''' def __init__( self : List[Any], lowerCamelCase : Dict="", lowerCamelCase ...
272
1
"""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.activations import gelu_new, gelu_python, get_activation @require_torch class __SCREAMING_SNAKE_CASE ( ...
272
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int , __lowerCamelCase : int ): """simple docstring""" return int((input_a, input_a).count(0 ) != 0 ) def snake_case__ ( ): """simple docstring""" assert nand_gate(0 , 0 ...
272
1
"""simple docstring""" import shutil import tempfile import unittest from transformers import ( SPIECE_UNDERLINE, AddedToken, BatchEncoding, NllbTokenizer, NllbTokenizerFast, is_torch_available, ) from transformers.testing_utils import ( get_tests_dir, nested_simplify, req...
272
"""simple docstring""" import numpy as np import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel from ...utils import logging _lowercase : int = logging.get_logger(__name__) class __SCREAMING_SNAKE_CASE ( lowerCAmelC...
272
1
"""simple docstring""" import argparse import math import traceback import dateutil.parser as date_parser import requests def snake_case__ ( __lowerCamelCase : Dict ): """simple docstring""" lowerCamelCase__ : Union[str, Any] ={} lowerCamelCase__ : List[Any] ...
272
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) _lowercase : Any = { "configuration_trocr": ["TROCR_PRETRAINED_CONFIG_...
272
1
"""simple docstring""" from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils import ModelMixin from .prior_tra...
272
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings _lowercase : Tuple = r"\n [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and\n can be use...
272
1
"""simple docstring""" from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import ...
272
"""simple docstring""" from ..utils import DummyObject, requires_backends class __SCREAMING_SNAKE_CASE ( metaclass=lowerCAmelCase_ ): '''simple docstring''' _a = ['torch', 'torchsde'] def __init__( self : Union[str, Any], *lowerCamelCase ...
272
1
"""simple docstring""" def snake_case__ ( __lowerCamelCase : Union[str, Any] , __lowerCamelCase : Any , __lowerCamelCase : Any , __lowerCamelCase : Optional[Any] , __lowerCamelCase : List[Any] , __lowerCamelCase : Dict ): """s...
272
"""simple docstring""" from typing import List import jiwer import jiwer.transforms as tr from packaging import version import datasets from datasets.config import PY_VERSION if PY_VERSION < version.parse("3.8"): import importlib_metadata else: import importlib.metadata as importlib_metadata _lowerc...
272
1
"""simple docstring""" import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as...
272
"""simple docstring""" from ...processing_utils import ProcessorMixin class __SCREAMING_SNAKE_CASE ( lowerCAmelCase_ ): '''simple docstring''' _a = 'SpeechT5FeatureExtractor' _a = 'SpeechT5Tokenizer' def __init__( self : D...
272
1
"""simple docstring""" from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline _lowercase : List[Any] = logging.get_logger(__...
272
"""simple docstring""" from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging _lowercase : List[str] = logging.get_logger(__name__) def snake_case__ ( __lowerCamelCase : Union[tf.Tensor, np.ndarray] ): ...
272
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _lowercase : Any = { "configuration_resnet": ["RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP...
272
"""simple docstring""" import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, init_empty_weight...
272
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available _lowercase : Optional[int] = {"tokenization_herbert": ["HerbertTokenizer"]} try: if not is_tokenizers_available(): raise OptionalDepende...
272
"""simple docstring""" from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, ran...
272
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowercase : Dict = { "configuration_nezha": ["NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP", "NezhaConfig"], } try: if not i...
272
"""simple docstring""" import numpy as np from PIL import Image def snake_case__ ( __lowerCamelCase : np.ndarray , __lowerCamelCase : int , __lowerCamelCase : int ): """simple docstring""" lowerCamelCase__ : List[Any] =np.array(__lowerCamelCase ...
272
1
"""simple docstring""" import re import time from typing import Optional import IPython.display as disp from ..trainer_callback import TrainerCallback from ..trainer_utils import IntervalStrategy, has_length def snake_case__ ( __lowerCamelCase : Any ): """simple docstring""" ...
272
"""simple docstring""" import math import flax.linen as nn import jax.numpy as jnp def snake_case__ ( __lowerCamelCase : jnp.ndarray , __lowerCamelCase : int , __lowerCamelCase : float = 1 , __lowerCamelCase : float = 1 , __lowerCamelCase :...
272
1
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics f...
272
"""simple docstring""" import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as...
272
1
"""simple docstring""" def snake_case__ ( __lowerCamelCase : list ): """simple docstring""" lowerCamelCase__ : List[Any] =len(__lowerCamelCase ) for i in range(1 , __lowerCamelCase ): lowerCamelCase__ : Any =collection[i] lowerCamelCase_...
272
"""simple docstring""" from collections import defaultdict class __SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__( self : Union[str, Any], lowerCamelCase : List[Any], lowerCamelCase : List[str] )-> Optional[int]: lowerCamelCase__ : List[A...
272
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_image_inputs if is_torc...
272
"""simple docstring""" import argparse import torch from transformers import YosoConfig, YosoForMaskedLM def snake_case__ ( __lowerCamelCase : str ): """simple docstring""" if "model" in orig_key: lowerCamelCase__ : Optional[int] =orig_key.replace('''model.''' ...
272
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor _lowercase : Dict = logging.get_logger(__name__) class __SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE_ ): '''simple docstring''' d...
350
"""simple docstring""" # Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the config ...
272
0
"""simple docstring""" import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets _lowercase : Tuple = "\\n@article{hendrycksmath2021,\n title={Measuring Mathematical Problem Solving With the MATH Dataset},\n author={Dan Hendrycks\n and Collin Burns\n ...
351
"""simple docstring""" from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeq...
272
0
"""simple docstring""" import gc import importlib.metadata import tempfile import unittest from packaging import version from transformers import ( AutoModel, AutoModelForCausalLM, AutoModelForSeqaSeqLM, AutoModelForSequenceClassification, AutoTokenizer, BitsAndBytesConfig, pipel...
352
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int ): """simple docstring""" lowerCamelCase__ : List[Any] =[0] * len(__lowerCamelCase ) lowerCamelCase__ : List[Any] =[] lowerCamelCase__ : List[Any] =[1] * len(__lowerCamelCase ) ...
272
0
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration _lowercase : int = 5_0_0_0_0_0 _lowercase , _lowercase : Tuple = os.path.split(__file__) _lowercase : Union[str, Any] = ...
353
"""simple docstring""" # Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def snake_case__ ( __lowerCamelCase : Union[str, Any] , __lowerCamelCase : int , __lowerCamelCase : Tuple , __lowerCamelCase : Union[str, Any] ): ...
272
0
"""simple docstring""" import argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basicConfig(level=logging.INFO) _lo...
354
"""simple docstring""" from __future__ import annotations def snake_case__ ( __lowerCamelCase : str , __lowerCamelCase : list[str] | None = None ): """simple docstring""" lowerCamelCase__ : List[Any] =word_bank or [] # create a table lowerCamelCase__ ...
272
0
"""simple docstring""" import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast _lowercase : List[Any] = datasets.utils.logging.get_logger(__name__) @datac...
355
"""simple docstring""" import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device _lowercase : Tuple = False class __SCREAMING_SNAKE_CASE ...
272
0
"""simple docstring""" import datasets from .evaluate import evaluate _lowercase : List[Any] = """\ @article{hendrycks2021cuad, title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review}, author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball}, ...
356
"""simple docstring""" import os from collections import deque import torch from torch.utils.data import Dataset class __SCREAMING_SNAKE_CASE ( lowerCAmelCase_ ): '''simple docstring''' def __init__( self : List[Any], lowerCamelCase : Dict="", lowerCamelCase ...
272
0
"""simple docstring""" def snake_case__ ( __lowerCamelCase : str ): """simple docstring""" lowerCamelCase__ : str =[] lowerCamelCase__ : Optional[int] =[] lowerCamelCase__ : Dict ={ '''^''': 3, '''*''': 2, '''/''': 2, '''%'''...
357
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int , __lowerCamelCase : int ): """simple docstring""" return int((input_a, input_a).count(0 ) != 0 ) def snake_case__ ( ): """simple docstring""" assert nand_gate(0 , 0 ...
272
0