code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' from collections import defaultdict from typing import Optional from ..image_utils import load_image from ..utils import ( add_end_docstrings, is_torch_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, ChunkPipeline ...
127
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transfor...
127
1
'''simple docstring''' import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_ge...
127
'''simple docstring''' import flax.linen as nn import jax.numpy as jnp from .attention_flax import FlaxTransformeraDModel from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD class SCREAMING_SNAKE_CASE( nn.Module ): """simple docstring""...
127
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available UpperCamelCase__: int = { "configuration_bridgetower": [ "BRIDGETOWER_PRETRAINED_CONFIG_ARCHIVE_MAP",...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : Any , _lowerCAmelCase : Optional[Any] , _lowerCAmelCase : Any , _lowerCAmelCase : Union[str, Any] ) -> Dict: # Return True if there is node that has not iterated. UpperCAmelCase : List[Any...
127
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...tes...
127
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: int = logging.get_logger(__name__) # TODO Update this UpperCamelCase__: Any ...
127
1
'''simple docstring''' from __future__ import annotations UpperCamelCase__: Optional[Any] = "#" class SCREAMING_SNAKE_CASE: """simple docstring""" def __init__( self : List[Any] ) -> None: UpperCAmelCase : di...
127
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: List[Any] = logging.get_logger(__name__) UpperCamelCase__: str = { "unc-nlp/lxmert-base-uncased": "https://huggingface.co/unc-nlp/lxmer...
127
1
'''simple docstring''' import random import unittest import numpy as np import transformers from transformers import is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax if is_flax_available(): import os impor...
127
'''simple docstring''' import math from numpy import inf from scipy.integrate import quad def snake_case_ ( _lowerCAmelCase : float ) -> float: if num <= 0: raise ValueError('''math domain error''' ) return quad(_lowerCAmelCase , 0 , _lo...
127
1
'''simple docstring''' import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() Upp...
127
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transforme...
127
1
'''simple docstring''' import math from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: Tuple = logging.get_logger(__name__) UpperCamelCase__: Dict = { "facebook/data2vec-base-960h": "https://huggingface.co/f...
127
'''simple docstring''' from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from .....
127
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 : Optional[int] ) -> Dict: ...
127
'''simple docstring''' import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format...
127
1
'''simple docstring''' from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase__: str = { "configuration_informer": [ "INFORMER_PRETRAINED_CONFIG_AR...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str , _lowerCAmelCase : str ) -> int: if len(_lowerCAmelCase ) != len(_lowerCAmelCase ): raise ValueError('''String lengths must match!''' ) UpperCAmelCase : List[str] ...
127
1
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : list ) -> int: if not grid or not grid[0]: raise TypeError('''The grid does not contain the appropriate information''' ) for cell_n in range(1 , len(grid[0] ) ): gri...
127
'''simple docstring''' from __future__ import annotations def snake_case_ ( _lowerCAmelCase : list[int] ) -> int: if not nums: return 0 UpperCAmelCase : Tuple = nums[0] UpperCAmelCase : List[str] = 0 ...
127
1
'''simple docstring''' import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig UpperCamelCase__: Tuple = { ...
127
'''simple docstring''' import re def snake_case_ ( _lowerCAmelCase : str ) -> str: if len(re.findall('''[ATCG]''' , _lowerCAmelCase ) ) != len(_lowerCAmelCase ): raise ValueError('''Invalid Strand''' ) return dna.translate(dna.make...
127
1
'''simple docstring''' from __future__ import annotations def snake_case_ ( _lowerCAmelCase : int = 4 ) -> list[list[int]]: UpperCAmelCase : Any = abs(_lowerCAmelCase ) or 4 return [[1 + x + y * row_size for x in range(_lowerCAmelCase )] ...
127
'''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 if is_torch...
127
1
'''simple docstring''' from typing import Dict, List, Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCamelCase__: List[Any] = logging.get_logger(__name__) UpperCamelCase__: Optional[Any] = { ...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str ) -> int: if not head: return True # split the list to two parts UpperCAmelCase , UpperCAmelCase : str = head.next, head while fast and fast.next: ...
127
1
'''simple docstring''' import argparse import os import re import packaging.version UpperCamelCase__: Tuple = "examples/" UpperCamelCase__: Any = { "examples": (re.compile(r"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSIO...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int , _lowerCAmelCase : Dict , _lowerCAmelCase : List[str] , _lowerCAmelCase : str , _lowerCAmelCase : Optional[int] , _lowerCAmelCase : List[Any] ) -> Union[str, Any]: if index == r: ...
127
1
'''simple docstring''' import warnings from ..trainer import Trainer from ..utils import logging UpperCamelCase__: Union[str, Any] = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE( A__ ): """simple docstring""" def __ini...
127
'''simple docstring''' import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets UpperCamelCase__: Any = datasets.logging.get_logger(__name__) UpperCamelCase__: Union[str, Any] = "\\n@inproceedings{bleur...
127
1
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int , _lowerCAmelCase : Dict , _lowerCAmelCase : List[str] , _lowerCAmelCase : str , _lowerCAmelCase : Optional[int] , _lowerCAmelCase : List[Any] ) -> Union[str, Any]: if index == r: ...
127
'''simple docstring''' import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class SCREAMING_SNAKE_CASE( unittest.TestCase ): """simple docstring""" def A ( self : Tuple ) -> Optional[Any]:...
127
1
'''simple docstring''' import re import string from collections import Counter import sacrebleu import sacremoses from packaging import version import datasets UpperCamelCase__: Dict = "\n@inproceedings{xu-etal-2016-optimizing,\n title = {Optimizing Statistical Machi...
127
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCamelCase__: str = logging.get_lo...
127
1
'''simple docstring''' from typing import Optional, Tuple import jax import jax.numpy as jnp from flax import linen as nn from flax.core.frozen_dict import FrozenDict from transformers import CLIPConfig, FlaxPreTrainedModel from transformers.models.clip.modeling_flax_clip import FlaxCLIPVis...
127
'''simple docstring''' import argparse import hashlib # hashlib is only used inside the Test class import struct class SCREAMING_SNAKE_CASE: """simple docstring""" def __init__( self : List[str] , __snake_case : Any ) -> Lis...
127
1
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int = 1000 ) -> int: UpperCAmelCase : List[str] = -1 UpperCAmelCase : int = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int ) -> list: UpperCAmelCase : Union[str, Any] = int(_lowerCAmelCase ) if n_element < 1: UpperCAmelCase : int = ValueError('''a should be a positive num...
127
1
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase__: List[str] = { "configuration_trajectory_transformer": [ "TRAJECTORY_TRANSFORMER_PRETRAINED_CONFIG_ARCHI...
127
'''simple docstring''' import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets UpperCamelCase__: str = "\\n @inproceedings{kakwani2020indicnlpsuite,\n title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchm...
127
1
'''simple docstring''' import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git impor...
127
'''simple docstring''' from __future__ import annotations UpperCamelCase__: Tuple = 1.60_21E-19 # units = C def snake_case_ ( _lowerCAmelCase : float , _lowerCAmelCase : float , _lowerCAmelCase : float , ) -> tuple[str, float]: if (conductivity,...
127
1
'''simple docstring''' import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def snake_case_ ( _lowerCAmelCase : Dict ) -> List[str]: # vision encoder if "img_encoder.pos_e...
127
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transfor...
127
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.generation import DisjunctiveConstraint @require_torch class SCREAMING_...
127
'''simple docstring''' import flax.linen as nn import jax.numpy as jnp from .attention_flax import FlaxTransformeraDModel from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD class SCREAMING_SNAKE_CASE( nn.Module ): """simple docstring""...
127
1
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int = 1000000 ) -> int: UpperCAmelCase : Union[str, Any] = limit + 1 UpperCAmelCase : str = [0] * limit for first_term in range(1 , _lowerCAmelCase ): ...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : Any , _lowerCAmelCase : Optional[Any] , _lowerCAmelCase : Any , _lowerCAmelCase : Union[str, Any] ) -> Dict: # Return True if there is node that has not iterated. UpperCAmelCase : List[Any...
127
1
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, Wav...
127
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: int = logging.get_logger(__name__) # TODO Update this UpperCamelCase__: Any ...
127
1
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor ...
127
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: List[Any] = logging.get_logger(__name__) UpperCamelCase__: str = { "unc-nlp/lxmert-base-uncased": "https://huggingface.co/unc-nlp/lxmer...
127
1
'''simple docstring''' import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets UpperCamelCase__: str = "\\n @inproceedings{kakwani2020indicnlpsuite,\n title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchm...
127
'''simple docstring''' import math from numpy import inf from scipy.integrate import quad def snake_case_ ( _lowerCAmelCase : float ) -> float: if num <= 0: raise ValueError('''math domain error''' ) return quad(_lowerCAmelCase , 0 , _lo...
127
1
'''simple docstring''' import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenizatio...
127
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transforme...
127
1
'''simple docstring''' from collections import defaultdict from math import ceil, sqrt def snake_case_ ( _lowerCAmelCase : int = 1000000 , _lowerCAmelCase : int = 10 ) -> int: UpperCAmelCase : defaultdict = defaultdict(_lowerCAmelCase ) ...
127
'''simple docstring''' from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from .....
127
1
'''simple docstring''' from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: Optional[Any] = logging.get_logger(__name__) UpperCamelCase__: List[Any] = { "microsoft...
127
'''simple docstring''' import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format...
127
1
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : list ) -> list: if len(_lowerCAmelCase ) <= 1: return [tuple(_lowerCAmelCase )] UpperCAmelCase : Dict = [] def generate(_lowerCAmelCase : int , _lower...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str , _lowerCAmelCase : str ) -> int: if len(_lowerCAmelCase ) != len(_lowerCAmelCase ): raise ValueError('''String lengths must match!''' ) UpperCAmelCase : List[str] ...
127
1
'''simple docstring''' from string import ascii_uppercase UpperCamelCase__: List[str] = {str(ord(c) - 55): c for c in ascii_uppercase} def snake_case_ ( _lowerCAmelCase : int , _lowerCAmelCase : int ) -> str: if isinstance(_lowerCAmelCase , _lowerC...
127
'''simple docstring''' from __future__ import annotations def snake_case_ ( _lowerCAmelCase : list[int] ) -> int: if not nums: return 0 UpperCAmelCase : Tuple = nums[0] UpperCAmelCase : List[str] = 0 ...
127
1
'''simple docstring''' import os def snake_case_ ( _lowerCAmelCase : str = "input.txt" ) -> int: with open(os.path.join(os.path.dirname(_lowerCAmelCase ) , _lowerCAmelCase ) ) as input_file: UpperCAmelCase : List[str] = [ ...
127
'''simple docstring''' import re def snake_case_ ( _lowerCAmelCase : str ) -> str: if len(re.findall('''[ATCG]''' , _lowerCAmelCase ) ) != len(_lowerCAmelCase ): raise ValueError('''Invalid Strand''' ) return dna.translate(dna.make...
127
1
'''simple docstring''' import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datase...
127
'''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 if is_torch...
127
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) UpperCamelCase__: Optional...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str ) -> int: if not head: return True # split the list to two parts UpperCAmelCase , UpperCAmelCase : str = head.next, head while fast and fast.next: ...
127
1
'''simple docstring''' import contextlib import copy import random from typing import Any, Dict, Iterable, Optional, Union import numpy as np import torch from .utils import deprecate, is_transformers_available if is_transformers_available(): import transformers def ...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int , _lowerCAmelCase : Dict , _lowerCAmelCase : List[str] , _lowerCAmelCase : str , _lowerCAmelCase : Optional[int] , _lowerCAmelCase : List[Any] ) -> Union[str, Any]: if index == r: ...
127
1
'''simple docstring''' from heapq import heappop, heappush import numpy as np def snake_case_ ( _lowerCAmelCase : np.ndarray , _lowerCAmelCase : tuple[int, int] , _lowerCAmelCase : tuple[int, int] , _lowerCAmelCase : bool , ) -> tuple[float | int, list[tuple[int,...
127
'''simple docstring''' import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets UpperCamelCase__: Any = datasets.logging.get_logger(__name__) UpperCamelCase__: Union[str, Any] = "\\n@inproceedings{bleur...
127
1
'''simple docstring''' from __future__ import annotations from math import gcd def snake_case_ ( _lowerCAmelCase : int , _lowerCAmelCase : int = 2 , _lowerCAmelCase : int = 1 , _lowerCAmelCase : int = 3 , ) -> int | None: # A value less than 2 can cause a...
127
'''simple docstring''' import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class SCREAMING_SNAKE_CASE( unittest.TestCase ): """simple docstring""" def A ( self : Tuple ) -> Optional[Any]:...
127
1
'''simple docstring''' import importlib import inspect import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py UpperCamelCase__: Any = "src/transformers" # Th...
127
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCamelCase__: str = logging.get_lo...
127
1
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class SCREAMING_SNAKE_CASE( A__ ): """simple docstring""" lowerCamelCase__ = ["""image_processor""...
127
'''simple docstring''' import argparse import hashlib # hashlib is only used inside the Test class import struct class SCREAMING_SNAKE_CASE: """simple docstring""" def __init__( self : List[str] , __snake_case : Any ) -> Lis...
127
1
'''simple docstring''' import json import os import tempfile import unittest import unittest.mock as mock from pathlib import Path from requests.exceptions import HTTPError from transformers.utils import ( CONFIG_NAME, FLAX_WEIGHTS_NAME, TF2_WEIGHTS_NAME, TRANSFORMERS...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int ) -> list: UpperCAmelCase : Union[str, Any] = int(_lowerCAmelCase ) if n_element < 1: UpperCAmelCase : int = ValueError('''a should be a positive num...
127
1
'''simple docstring''' import os from glob import glob import imageio import torch import torchvision import wandb from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan from loaders import load_vqgan from PIL import Image from torch import nn from t...
127
'''simple docstring''' import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets UpperCamelCase__: str = "\\n @inproceedings{kakwani2020indicnlpsuite,\n title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchm...
127
1
'''simple docstring''' import json import sys def snake_case_ ( _lowerCAmelCase : List[str] , _lowerCAmelCase : Dict ) -> int: with open(_lowerCAmelCase , encoding='''utf-8''' ) as f: UpperCAmelCase : int = json.load(_lowerCAme...
127
'''simple docstring''' from __future__ import annotations UpperCamelCase__: Tuple = 1.60_21E-19 # units = C def snake_case_ ( _lowerCAmelCase : float , _lowerCAmelCase : float , _lowerCAmelCase : float , ) -> tuple[str, float]: if (conductivity,...
127
1
'''simple docstring''' from ....configuration_utils import PretrainedConfig from ....utils import logging UpperCamelCase__: List[str] = logging.get_logger(__name__) # TODO: upload to AWS UpperCamelCase__: Tuple = { "yjernite/retribert-base-uncased": ( ...
127
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transfor...
127
1
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str , _lowerCAmelCase : str , _lowerCAmelCase : Tuple , _lowerCAmelCase : List[str] ) -> Optional[int]: if height >= 1: move_tower(height - 1 , _lowerCAmelCase , _lowerCAmelCase , _low...
127
'''simple docstring''' import flax.linen as nn import jax.numpy as jnp from .attention_flax import FlaxTransformeraDModel from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD class SCREAMING_SNAKE_CASE( nn.Module ): """simple docstring""...
127
1
'''simple docstring''' from __future__ import annotations import time from collections.abc import Sequence from random import randint from matplotlib import pyplot as plt def snake_case_ ( _lowerCAmelCase : Sequence[float] , _lowerCAmelCase : int , _lowerCAmelCase :...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : Any , _lowerCAmelCase : Optional[Any] , _lowerCAmelCase : Any , _lowerCAmelCase : Union[str, Any] ) -> Dict: # Return True if there is node that has not iterated. UpperCAmelCase : List[Any...
127
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase__: str = logging.get_logger(__name__) UpperCamelCase__: D...
127
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: int = logging.get_logger(__name__) # TODO Update this UpperCamelCase__: Any ...
127
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,...
127
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: List[Any] = logging.get_logger(__name__) UpperCamelCase__: str = { "unc-nlp/lxmert-base-uncased": "https://huggingface.co/unc-nlp/lxmer...
127
1
'''simple docstring''' 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_...
127
'''simple docstring''' import math from numpy import inf from scipy.integrate import quad def snake_case_ ( _lowerCAmelCase : float ) -> float: if num <= 0: raise ValueError('''math domain error''' ) return quad(_lowerCAmelCase , 0 , _lo...
127
1
'''simple docstring''' from __future__ import annotations class SCREAMING_SNAKE_CASE: """simple docstring""" def __init__( self : Dict , __snake_case : int = 0 ) -> Optional[Any]: UpperCAmelCase : int = ...
127
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transforme...
127
1
'''simple docstring''' import re import string import numpy as np import datasets UpperCamelCase__: List[str] = "\nReturns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list.\n" ...
127
'''simple docstring''' from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from .....
127
1
'''simple docstring''' from __future__ import annotations from math import pow, sqrt def snake_case_ ( _lowerCAmelCase : float , _lowerCAmelCase : float , _lowerCAmelCase : float ) -> dict[str, float]: if (resistance, reactance, impedance).count(0 ) != 1:...
127
'''simple docstring''' import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format...
127
1
'''simple docstring''' from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvaila...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str , _lowerCAmelCase : str ) -> int: if len(_lowerCAmelCase ) != len(_lowerCAmelCase ): raise ValueError('''String lengths must match!''' ) UpperCAmelCase : List[str] ...
127
1
'''simple docstring''' from PIL import Image def snake_case_ ( _lowerCAmelCase : Image ) -> Image: UpperCAmelCase , UpperCAmelCase : Optional[int] = image.size UpperCAmelCase : int = 0 UpperCAmelCase : D...
127
'''simple docstring''' from __future__ import annotations def snake_case_ ( _lowerCAmelCase : list[int] ) -> int: if not nums: return 0 UpperCAmelCase : Tuple = nums[0] UpperCAmelCase : List[str] = 0 ...
127
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, ...
127
'''simple docstring''' import re def snake_case_ ( _lowerCAmelCase : str ) -> str: if len(re.findall('''[ATCG]''' , _lowerCAmelCase ) ) != len(_lowerCAmelCase ): raise ValueError('''Invalid Strand''' ) return dna.translate(dna.make...
127
1
'''simple docstring''' import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 UpperCamelCase__: List[str] = 0b1...
127
'''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 if is_torch...
127
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 if is_torch...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str ) -> int: if not head: return True # split the list to two parts UpperCAmelCase , UpperCAmelCase : str = head.next, head while fast and fast.next: ...
127
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property ...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int , _lowerCAmelCase : Dict , _lowerCAmelCase : List[str] , _lowerCAmelCase : str , _lowerCAmelCase : Optional[int] , _lowerCAmelCase : List[Any] ) -> Union[str, Any]: if index == r: ...
127
1
'''simple docstring''' import sys def snake_case_ ( _lowerCAmelCase : List[Any] ) -> List[str]: UpperCAmelCase : Any = len(_lowerCAmelCase ) UpperCAmelCase : List[Any] = [[0 for x in range(_lowerCAmelCase )] for x in ra...
127
'''simple docstring''' import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets UpperCamelCase__: Any = datasets.logging.get_logger(__name__) UpperCamelCase__: Union[str, Any] = "\\n@inproceedings{bleur...
127
1
'''simple docstring''' import collections import gzip import os import urllib import numpy from tensorflow.python.framework import dtypes, random_seed from tensorflow.python.platform import gfile from tensorflow.python.util.deprecation import deprecated UpperCamelCase__: Union[str, Any...
127
'''simple docstring''' import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class SCREAMING_SNAKE_CASE( unittest.TestCase ): """simple docstring""" def A ( self : Tuple ) -> Optional[Any]:...
127
1
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str ) -> list[int]: UpperCAmelCase : Optional[Any] = [0 for i in range(len(_lowerCAmelCase ) )] # initialize interval's left pointer and right pointer UpperCAmelCase , ...
127
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCamelCase__: str = logging.get_lo...
127
1
'''simple docstring''' import numpy as np def snake_case_ ( _lowerCAmelCase : int , _lowerCAmelCase : List[Any] , _lowerCAmelCase : Tuple , _lowerCAmelCase : List[str] , _lowerCAmelCase : Union[str, Any] ) -> Union[str, Any]: UpperCAmelCase : Li...
127
'''simple docstring''' import argparse import hashlib # hashlib is only used inside the Test class import struct class SCREAMING_SNAKE_CASE: """simple docstring""" def __init__( self : List[str] , __snake_case : Any ) -> Lis...
127
1
'''simple docstring''' from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase__: str = logging.get_l...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int ) -> list: UpperCAmelCase : Union[str, Any] = int(_lowerCAmelCase ) if n_element < 1: UpperCAmelCase : int = ValueError('''a should be a positive num...
127
1
'''simple docstring''' from __future__ import annotations from scipy.special import comb # type: ignore class SCREAMING_SNAKE_CASE: """simple docstring""" def __init__( self : Optional[int] , __snake_case : list[tuple[float, float]] ...
127
'''simple docstring''' import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets UpperCamelCase__: str = "\\n @inproceedings{kakwani2020indicnlpsuite,\n title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchm...
127
1
'''simple docstring''' import re from typing import Callable, List, Optional, Union import tensorflow as tf try: from tensorflow.keras.optimizers.legacy import Adam except ImportError: from tensorflow.keras.optimizers import Adam class SCREAMING_SNAKE_CASE( tf.k...
127
'''simple docstring''' from __future__ import annotations UpperCamelCase__: Tuple = 1.60_21E-19 # units = C def snake_case_ ( _lowerCAmelCase : float , _lowerCAmelCase : float , _lowerCAmelCase : float , ) -> tuple[str, float]: if (conductivity,...
127
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: List[Any] = logging.get_logger(__name__) UpperCamelCase__: str = { "unc-nlp/lxmert-base-uncased": "https://huggingface.co/unc-nlp/lxmer...
127
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transfor...
127
1
'''simple docstring''' from __future__ import annotations def snake_case_ ( _lowerCAmelCase : list[int] ) -> int: if not nums: return 0 UpperCAmelCase : Tuple = nums[0] UpperCAmelCase : List[str] = 0 ...
127
'''simple docstring''' import flax.linen as nn import jax.numpy as jnp from .attention_flax import FlaxTransformeraDModel from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD class SCREAMING_SNAKE_CASE( nn.Module ): """simple docstring""...
127
1
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.or...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : Any , _lowerCAmelCase : Optional[Any] , _lowerCAmelCase : Any , _lowerCAmelCase : Union[str, Any] ) -> Dict: # Return True if there is node that has not iterated. UpperCAmelCase : List[Any...
127
1
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int ) -> bool: UpperCAmelCase : Union[str, Any] = n ** (1 / 3) return (val * val * val) == n if __name__ == "__main__": print(perfect_cube(27)) print(perfect_cube(4)) ...
127
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: int = logging.get_logger(__name__) # TODO Update this UpperCamelCase__: Any ...
127
1
'''simple docstring''' import logging import math import os from dataclasses import dataclass, field from glob import glob from typing import Optional from torch.utils.data import ConcatDataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_WITH_LM_HEAD_M...
127
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: List[Any] = logging.get_logger(__name__) UpperCamelCase__: str = { "unc-nlp/lxmert-base-uncased": "https://huggingface.co/unc-nlp/lxmer...
127
1
'''simple docstring''' import unittest from transformers import BertGenerationConfig, 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 ...
127
'''simple docstring''' import math from numpy import inf from scipy.integrate import quad def snake_case_ ( _lowerCAmelCase : float ) -> float: if num <= 0: raise ValueError('''math domain error''' ) return quad(_lowerCAmelCase , 0 , _lo...
127
1
'''simple docstring''' import logging import os import sys import warnings from dataclasses import dataclass, field from random import randint from typing import Optional import datasets import evaluate import numpy as np from datasets import DatasetDict, load_dataset import transfor...
127
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transforme...
127
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: Optional[int] = logging.get_logger(__name__) UpperCamelCase__: Any = { "microsoft/markuplm-base": "https://huggingface.co/microsoft/mar...
127
'''simple docstring''' from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from .....
127
1
'''simple docstring''' import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def snake_case_ ( _lowerCAmelCase : Dict , _lowerCAmelCase : Dict , _lowerCAmelCase : str ) -> Optional[int]: Upp...
127
'''simple docstring''' import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format...
127
1
'''simple docstring''' import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger UpperCamelCase__: str = "<<<<<<< This should probably be modified beca...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str , _lowerCAmelCase : str ) -> int: if len(_lowerCAmelCase ) != len(_lowerCAmelCase ): raise ValueError('''String lengths must match!''' ) UpperCAmelCase : List[str] ...
127
1
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import _LazyModule UpperCamelCase__: Dict = {"tokenization_tapex": ["TapexTokenizer"]} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys Uppe...
127
'''simple docstring''' from __future__ import annotations def snake_case_ ( _lowerCAmelCase : list[int] ) -> int: if not nums: return 0 UpperCAmelCase : Tuple = nums[0] UpperCAmelCase : List[str] = 0 ...
127
1
'''simple docstring''' import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py UpperCamelCase__: Tuple = "src/diffusers" # Matches is_xxx_available() Uppe...
127
'''simple docstring''' import re def snake_case_ ( _lowerCAmelCase : str ) -> str: if len(re.findall('''[ATCG]''' , _lowerCAmelCase ) ) != len(_lowerCAmelCase ): raise ValueError('''Invalid Strand''' ) return dna.translate(dna.make...
127
1
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transfor...
127
'''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 if is_torch...
127
1
'''simple docstring''' import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Image from .base import TaskTemplate @dataclass(frozen=A__ ) class SCREAMING_SNAKE_CASE( A__ ): """s...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str ) -> int: if not head: return True # split the list to two parts UpperCAmelCase , UpperCAmelCase : str = head.next, head while fast and fast.next: ...
127
1
'''simple docstring''' import re def snake_case_ ( _lowerCAmelCase : str ) -> bool: UpperCAmelCase : Optional[int] = re.compile(R'''^(\+91[\-\s]?)?[0]?(91)?[789]\d{9}$''' ) if match := re.search(_lowerCAmelCase , _lowerCAmelCase ): ...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int , _lowerCAmelCase : Dict , _lowerCAmelCase : List[str] , _lowerCAmelCase : str , _lowerCAmelCase : Optional[int] , _lowerCAmelCase : List[Any] ) -> Union[str, Any]: if index == r: ...
127
1
'''simple docstring''' import json import os import unittest from transformers.models.gptsan_japanese.tokenization_gptsan_japanese import ( VOCAB_FILES_NAMES, GPTSanJapaneseTokenizer, ) from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_com...
127
'''simple docstring''' import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets UpperCamelCase__: Any = datasets.logging.get_logger(__name__) UpperCamelCase__: Union[str, Any] = "\\n@inproceedings{bleur...
127
1
'''simple docstring''' from __future__ import annotations def snake_case_ ( _lowerCAmelCase : str ) -> list[int]: return [ord(_lowerCAmelCase ) - 96 for elem in plain] def snake_case_ ( _lowerCAmelCase : list[int] ) -> str: return "".join(c...
127
'''simple docstring''' import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class SCREAMING_SNAKE_CASE( unittest.TestCase ): """simple docstring""" def A ( self : Tuple ) -> Optional[Any]:...
127
1
'''simple docstring''' import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels UpperCamelCase__: int = object() # For specifying empty leaf dict `{}` Upper...
127
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCamelCase__: str = logging.get_lo...
127
1
'''simple docstring''' UpperCamelCase__: List[str] = [0, 2, 4, 6, 8] UpperCamelCase__: Optional[Any] = [1, 3, 5, 7, 9] def snake_case_ ( _lowerCAmelCase : int , _lowerCAmelCase : int , _lowerCAmelCase : list[int] , _lowerCAmelCase : int ...
127
'''simple docstring''' import argparse import hashlib # hashlib is only used inside the Test class import struct class SCREAMING_SNAKE_CASE: """simple docstring""" def __init__( self : List[str] , __snake_case : Any ) -> Lis...
127
1
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_squeezebert import SqueezeBertTokenizer UpperCamelCase__: Unio...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int ) -> list: UpperCAmelCase : Union[str, Any] = int(_lowerCAmelCase ) if n_element < 1: UpperCAmelCase : int = ValueError('''a should be a positive num...
127
1
'''simple docstring''' import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info...
127
'''simple docstring''' import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets UpperCamelCase__: str = "\\n @inproceedings{kakwani2020indicnlpsuite,\n title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchm...
127
1
'''simple docstring''' import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # =================# # UNet Conversion # # =================# UpperCamelCase__: Optional[Any] = [ # (stable-diffusion, HF Diffuse...
127
'''simple docstring''' from __future__ import annotations UpperCamelCase__: Tuple = 1.60_21E-19 # units = C def snake_case_ ( _lowerCAmelCase : float , _lowerCAmelCase : float , _lowerCAmelCase : float , ) -> tuple[str, float]: if (conductivity,...
127
1
'''simple docstring''' import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format...
127
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transfor...
127
1
'''simple docstring''' from __future__ import annotations UpperCamelCase__: Tuple = 1.60_21E-19 # units = C def snake_case_ ( _lowerCAmelCase : float , _lowerCAmelCase : float , _lowerCAmelCase : float , ) -> tuple[str, float]: if (conductivity,...
127
'''simple docstring''' import flax.linen as nn import jax.numpy as jnp from .attention_flax import FlaxTransformeraDModel from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD class SCREAMING_SNAKE_CASE( nn.Module ): """simple docstring""...
127
1
'''simple docstring''' import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin,...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : Any , _lowerCAmelCase : Optional[Any] , _lowerCAmelCase : Any , _lowerCAmelCase : Union[str, Any] ) -> Dict: # Return True if there is node that has not iterated. UpperCAmelCase : List[Any...
127
1
'''simple docstring''' import inspect import os import unittest from dataclasses import dataclass import torch from accelerate import Accelerator, DistributedDataParallelKwargs, GradScalerKwargs from accelerate.state import AcceleratorState from accelerate.test_utils import execute_subpr...
127
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: int = logging.get_logger(__name__) # TODO Update this UpperCamelCase__: Any ...
127
1
'''simple docstring''' from collections.abc import Callable from math import pi, sqrt from random import uniform from statistics import mean def snake_case_ ( _lowerCAmelCase : int ) -> Dict: # A local function to see if a dot lands in the circle. def is_in_...
127
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: List[Any] = logging.get_logger(__name__) UpperCamelCase__: str = { "unc-nlp/lxmert-base-uncased": "https://huggingface.co/unc-nlp/lxmer...
127
1
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class SCREAMIN...
127
'''simple docstring''' import math from numpy import inf from scipy.integrate import quad def snake_case_ ( _lowerCAmelCase : float ) -> float: if num <= 0: raise ValueError('''math domain error''' ) return quad(_lowerCAmelCase , 0 , _lo...
127
1
'''simple docstring''' import math def snake_case_ ( _lowerCAmelCase : int ) -> bool: if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all ...
127
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transforme...
127
1
'''simple docstring''' import argparse import os import re UpperCamelCase__: Optional[Any] = "src/transformers" # Pattern that looks at the indentation in a line. UpperCamelCase__: Union[str, Any] = re.compile(r"^(\s*)\S") # Pattern that matches `"key":" and ...
127
'''simple docstring''' from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from .....
127
1
'''simple docstring''' import os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_rea...
127
'''simple docstring''' import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format...
127
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_...
127
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str , _lowerCAmelCase : str ) -> int: if len(_lowerCAmelCase ) != len(_lowerCAmelCase ): raise ValueError('''String lengths must match!''' ) UpperCAmelCase : List[str] ...
127
1
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import req...
127
'''simple docstring''' from __future__ import annotations def snake_case_ ( _lowerCAmelCase : list[int] ) -> int: if not nums: return 0 UpperCAmelCase : Tuple = nums[0] UpperCAmelCase : List[str] = 0 ...
127
1
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : Dict , _lowerCAmelCase : Any ) -> Any: UpperCAmelCase : List[str] = 0 while b > 0: if b & 1: res += a a += a b >>= 1...
127
'''simple docstring''' import re def snake_case_ ( _lowerCAmelCase : str ) -> str: if len(re.findall('''[ATCG]''' , _lowerCAmelCase ) ) != len(_lowerCAmelCase ): raise ValueError('''Invalid Strand''' ) return dna.translate(dna.make...
127
1