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
import unittest from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin _A : str = get_tests_dir("""fixtures/spiece.model""...
100
'''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
0
import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu, calculate_r...
101
'''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
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __magic_name__ : Union[str, Any] = {"""configuration_vit_mae""": ["""V...
102
'''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
0
"""simple docstring""" from abc import ABC, abstractmethod from typing import List, Optional class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): def __init__( self : List[str] ): """simple docstring""" # test for the above condition self.te...
103
'''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
0
"""simple docstring""" def _lowerCamelCase ( UpperCAmelCase_ : int ) -> int: """simple docstring""" if not isinstance(UpperCAmelCase_, UpperCAmelCase_ ): raise ValueError("Input must be an integer" ) if input_num <= 0: raise Value...
104
'''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
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase__ : Union[str, Any] = {'''configuration_sew''': ['''SEW_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''SEWConfig''']} try: if not is_torch_available(): raise...
105
'''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
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __snake_case :Dict =logging.get_logger(__name__) __snake_case :Any ={'vo...
106
'''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
0
'''simple docstring''' import os from datetime import datetime as dt from github import Github _UpperCAmelCase : List[Any] = [ '''good first issue''', '''feature request''', '''wip''', ] def _SCREAMING_SNAKE_CASE ( ): _A = Github(os.environ['GITHUB_TOKEN'...
107
'''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
0
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, PNDMScheduler, StableDiffusionInpaintPipeline, UNetaDConditionModel from diffusers.utils import floats_tensor,...
108
'''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
0
'''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, require_t...
109
'''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
0
from PIL import Image def UpperCamelCase ( _a ) -> Image: '''simple docstring''' lowercase_ :Optional[int] = image.size lowercase_ :int = 0 lowercase_ :Dict = image.load() for i in range(...
257
'''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
0
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 __lowerCamelCase (UpperCAmelCase_...
403
'''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
0
"""simple docstring""" from statistics import mean, stdev def __UpperCAmelCase ( __lowerCamelCase , __lowerCamelCase = 3 ) -> list: lowercase__ : Optional[Any] = min(_lowerCAmelCase ) lowercase__ : Union[str, Any] = max...
560
'''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
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __lowerCamelCase : Dict = { "configuration_vision_text_dual_encoder": ["VisionTextDualEncoderConfig"], "processing_...
297
'''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
0
from ..models.auto import AutoModelForSeqaSeqLM, AutoTokenizer from .base import PipelineTool A_ : List[Any] = { "Acehnese Arabic": "ace_Arab", "Acehnese Latin": "ace_Latn", "Mesopotamian Arabic": "acm_Arab", "Ta'izzi-Adeni Arabic": "acq_Arab", "Tuni...
57
'''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
0
"""simple docstring""" import json import sys def lowerCamelCase ( _snake_case ,_snake_case ): with open(_lowerCAmelCase ,encoding='utf-8' ) as f: UpperCAmelCase__ : int = json.load(_lowerCAmelCase ) UpperCAmelCase__ : List[str] = ['''<detail...
110
'''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
0
import argparse from collections import OrderedDict from pathlib import Path import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision.transforms import functional as F from transformers import DetrImageProcessor, TableTransformerConfig, TableTransformerForOb...
592
'''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
0
'''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 __lowerCAmelCase : str = logging.get_logg...
262
'''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
0
import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets _lowerCamelCase = "\\n @inproceedings{kakwani2020indicnlpsuite,\n title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchmarks and Pre-trained Multilingual Language Models for I...
6
'''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
0
"""simple docstring""" from __future__ import annotations from random import random from typing import Generic, TypeVar a = TypeVar('''KT''') a = TypeVar('''VT''') class lowercase_ ( Generic[KT, VT] ): '''simple docstring''' def __init__( self : int...
7
'''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
0
def lowercase__ ( _UpperCamelCase = 2_00) -> int: """simple docstring""" UpperCamelCase = [1, 2, 5, 10, 20, 50, 1_00, 2_00] UpperCamelCase = [0] * (pence + 1) UpperCamelCase = 1 # base case: 1 way to make 0 pence for coin ...
280
'''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
0
from __future__ import annotations from typing import Any def UpperCamelCase ( _a ) -> int: '''simple docstring''' if not postfix_notation: return 0 lowercase_ :Tuple = {'''+''', '''-''', '''*''', '''/'''} lowercase...
257
'''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
0
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowercase ( A__ ): lowercase__ : List[str] = ["""image_processor""", """tokenizer"""] lowercase__ : Optional[Any] = """Vi...
403
'''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
0
"""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 ...
560
'''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
0
import collections import inspect import unittest from transformers import FocalNetConfig 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_backbone_common import Backbone...
297
'''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
0
import argparse import json import os from tensorflow.core.protobuf.saved_model_pba import SavedModel # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py A_ : Optional[Any] = "." # ...
57
'''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
0
"""simple docstring""" def lowerCamelCase ( _snake_case ): UpperCAmelCase__ : Union[str, Any] = int(_lowerCAmelCase ) if n_element < 1: UpperCAmelCase__ : int = ValueError('a should be a positive number' ) raise my_error UpperCAmelCase_...
110
'''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
0
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 ...test_configuration_common import Co...
592
'''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
0
'''simple docstring''' import os from tempfile import TemporaryDirectory from unittest import TestCase import pytest from absl.testing import parameterized from datasets import config from datasets.arrow_reader import HF_GCP_BASE_URL from datasets.builder import DatasetBuilder from datasets.dataset_dic...
262
'''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
0
from __future__ import annotations from typing import Any class UpperCamelCase_ : def __init__( self :int , __A :int ) -> None: """simple docstring""" SCREAMING_SNAKE_CASE__ = num_of_nodes SCREAMING_SNAKE_CASE__ = [] ...
6
'''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
0
"""simple docstring""" import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data...
7
'''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
0
from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. __magic_name__ : Optional[int] = 200 # Number of elements selected in every generation of evolution. The selection takes # place from best to wo...
280
'''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
0
import numpy # List of input, output pairs SCREAMING_SNAKE_CASE : List[Any] = ( ((5, 2, 3), 15), ((6, 5, 9), 25), ((11, 12, 13), 41), ((1, 1, 1), 8), ((11, 12, 13), 41), ) SCREAMING_SNAKE_CASE : Tuple = (((515, 22, 13), 555), ((61, 35, 49), 150)) S...
257
'''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
0
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 import jax.numpy as jnp from jax import...
403
'''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
0
"""simple docstring""" from .glue import GlueDataset, GlueDataTrainingArguments from .language_modeling import ( LineByLineTextDataset, LineByLineWithRefDataset, LineByLineWithSOPTextDataset, TextDataset, TextDatasetForNextSentencePrediction, ) from .squad import Squad...
560
'''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
0
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 from ...test_configuration_common import Con...
297
'''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
0
import argparse import os import re A_ : Optional[Any] = "src/transformers" # Pattern that looks at the indentation in a line. A_ : Union[str, Any] = re.compile(r'^(\s*)\S') # Pattern that matches `"key":" and puts `key` in group 0. A_ : ...
57
'''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
0
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNo...
110
'''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
0
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_subprocess_async, require_cuda, requi...
592
'''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
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCAmelCase : Optional[int] = logging.get_logger(__name__) __lowerCAmelCase : Any = { "microsoft/markuplm-base": "https://huggingface.co/mic...
262
'''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
0
import argparse import os import re import packaging.version _lowerCamelCase = "examples/" _lowerCamelCase = { "examples": (re.compile(R'^check_min_version\(\"[^\"]+\"\)\s*$', re.MULTILINE), "check_min_version(\"VERSION\")\n"), "init": (re.compile(R'^__version__\s+=\s+\"([^\"]+)\"\s...
6
'''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
0
"""simple docstring""" from __future__ import annotations a = 1.60_21e-19 # units = C def _snake_case ( _snake_case : float , _snake_case : float , _snake_case : float , ) -> tuple[str, float]: '''simple docstring''' ...
7
'''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
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __magic_name__ : int = logging.get_logger(__name__) __magic_name__ : Any = { "sayakpaul/vit-msn-base": "https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json", ...
280
'''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
0
from pathlib import Path import fire from tqdm import tqdm def UpperCamelCase ( _a="ro" , _a="en" , _a="wmt16" , _a=None ) -> None: '''simple docstring''' try: import datasets except (ModuleNotFoundError, ImportError): ...
257
'''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
0
import importlib import math import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Tuple, Union import flax import jax.numpy as jnp from ..utils import BaseOutput _lowerCamelCase : int = "scheduler_config.json" class lowercas...
403
'''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
0
"""simple docstring""" import socket def __UpperCAmelCase ( ) -> Optional[Any]: lowercase__ : str = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) lowercase__ : Union[str, Any] = socket.gethostname() lowercase__ : ...
560
'''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
0
def SCREAMING_SNAKE_CASE ( snake_case_ : str ): snake_case__ : str = [0] * len(_lowerCAmelCase ) for i in range(1 , len(_lowerCAmelCase ) ): # use last results for better performance - dynamic programming snake_case__ : List[str] = prefix_result[i - 1] while j > 0 ...
297
'''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
0
from typing import Optional, Tuple import jax import jax.numpy as jnp from flax import linen as nn from flax.core.frozen_dict import FrozenDict from transformers import CLIPConfig, FlaxPreTrainedModel from transformers.models.clip.modeling_flax_clip import FlaxCLIPVisionModule def snake_cas...
57
'''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
0
"""simple docstring""" from __future__ import annotations UpperCamelCase__ = "#" class a : def __init__( self ): UpperCAmelCase__ : dict = {} def __snake_case ( self , UpperCamelCase_ ): UpperCAmelCase__ : T...
110
'''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
0
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, TensorType snake_case_ ...
592
'''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
0
'''simple docstring''' from __future__ import annotations def lowerCAmelCase ( UpperCamelCase__ : str , UpperCamelCase__ : list[str] | None = None ): """simple docstring""" __UpperCAmelCase = word_bank or [] # create a table __UpperCAmelCase ...
262
'''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
0
_lowerCamelCase = [0, 2, 4, 6, 8] _lowerCamelCase = [1, 3, 5, 7, 9] def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: int , UpperCamelCase__: int , UpperCamelCase__: list[int] , UpperCamelCase__: int ): if remaining_length == 0: if digit...
6
'''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
0
"""simple docstring""" def _snake_case ( _snake_case : int ) -> bool: '''simple docstring''' _A = n ** (1 / 3) return (val * val * val) == n if __name__ == "__main__": print(perfect_cube(27)) print(perfect_cube(4))
7
'''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
0
def lowercase__ ( _UpperCamelCase , _UpperCamelCase , _UpperCamelCase , _UpperCamelCase , _UpperCamelCase , _UpperCamelCase) -> Union[str, Any]: """simple docstring""" if index == r: for j in range(_lowerCAmel...
280
'''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
0
class UpperCamelCase : '''simple docstring''' def __init__( self , UpperCamelCase_ ): lowercase_ :List[Any] = n lowercase_ :Dict = [None] * self.n lowercase_ :List[Any] = 0 # index of the fi...
257
'''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
0
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 _lowerCamelCase : List[str] = 0B101_100_111_110_110_010_010_000_011_110_11...
403
'''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
0
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase_ = { "configuration_informer": [ "INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", ...
560
'''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
0
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 __lowerCamelCase : Union[str, Any] = logging.get_logger(__name...
297
'''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
0
from graphs.minimum_spanning_tree_kruskal import kruskal def snake_case () -> Union[str, Any]: UpperCamelCase_: Tuple = 9 UpperCamelCase_: Union[str, Any] = [ [0, 1, 4], [0, 7, 8], [1, 2, 8], [7, 8, 7], [7, 6, 1], ...
57
'''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
0
"""simple docstring""" from __future__ import annotations def lowerCamelCase ( _snake_case ): return [ord(_lowerCAmelCase ) - 96 for elem in plain] def lowerCamelCase ( _snake_case ): return "".join(chr(elem + 96 ) for elem in encoded ) def lowerCamelCase ( ): UpperCAmel...
110
'''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
0
def lowerCamelCase__ ( snake_case_ : Dict ) -> str: __snake_case = 1 __snake_case = 2 while i * i <= n: __snake_case = 0 while n % i == 0: n //= i multiplicity += 1 n_divisors *= multiplicity + 1 i += 1...
592
'''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
0
'''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 __lowerCAmelCase : Union[str, Any] ...
262
'''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
0
from math import isqrt def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: int ): SCREAMING_SNAKE_CASE__ = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(i**2 , _lowerCAmelCase , _lowerCAmel...
6
'''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
0
"""simple docstring""" import tempfile import numpy as np import torch from transformers import AutoTokenizer, TaEncoderModel from diffusers import DDPMScheduler, UNetaDConditionModel from diffusers.models.attention_processor import AttnAddedKVProcessor from diffusers.pipelines.deepfloyd_if import IFWatermarker...
7
'''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
0
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_available(): import t...
280
'''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
0
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 SCREAMING_SNAKE_CASE : int = object() # For specifying empty leaf dict `{}` SCREAMING_SNAKE_CASE : Any ...
257
'''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
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available _lowerCamelCase : int = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvai...
403
'''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
0
"""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, TRANSFORME...
560
'''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
0
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 __lowerCamelCase : str = logging.get_logger(__name__) __lowerCamelCase : Optional[in...
297
'''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
0
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoProcessor, BlipaProc...
57
'''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
0
"""simple docstring""" from __future__ import annotations import time from collections.abc import Sequence from random import randint from matplotlib import pyplot as plt def lowerCamelCase ( _snake_case ,_snake_case ,_snake_case ): if not arr: return None, None, 0 if low == high:...
110
'''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
0
import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": snake_case_ = argparse.ArgumentParser( description=( 'Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Learned' ...
592
'''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
0
'''simple docstring''' from __future__ import annotations class A : def __init__( self : Dict , __a : int = 0 ) -> Optional[Any]: __UpperCAmelCase = key def snake_case__ ( self : Union[str, An...
262
'''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
0
import warnings from ...utils import logging from .image_processing_donut import DonutImageProcessor _lowerCamelCase = logging.get_logger(__name__) class UpperCamelCase_ ( A__ ): def __init__( self :List[str] , *__A :List[str] , **__A :Any ) -> N...
6
'''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
0
"""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 a = "src/transformers" # This is to make sure the transformers module i...
7
'''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
0
import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax...
280
'''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
0
SCREAMING_SNAKE_CASE : int = 8.31_44_62 # Unit - J mol-1 K-1 def UpperCamelCase ( _a , _a , _a ) -> float: '''simple docstring''' if moles < 0 or kelvin < 0 or volume < 0: raise ValueError('''Invalid inputs. Enter posit...
257
'''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
0
import argparse import torch from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel from transformers.utils import logging logging.set_verbosity_info() def __lowerCamelCase (UpperCAmelCase__ : Tuple , UpperCAmelCase__ : int , UpperC...
403
'''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
0
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class __A ( ...
560
'''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
0
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 transformers.utils import cached_property from ...tes...
297
'''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
0
import math from dataclasses import dataclass from typing import List, Optional, Tuple, Union import numpy as np import torch from diffusers.configuration_utils import ConfigMixin, register_to_config from diffusers.schedulers.scheduling_utils import SchedulerMixin from diffusers.utils import Ba...
57
'''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
0
"""simple docstring""" import PIL.Image import PIL.ImageOps from packaging import version from PIL import Image if version.parse(version.parse(PIL.__version__).base_version) >= version.parse('9.1.0'): UpperCamelCase__ = { "linear": PIL.Image.Resampling.BILINEAR, "bilinear": PIL.Image....
110
'''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
0
def lowerCamelCase__ ( snake_case_ : int ) -> int: if not isinstance(_lowerCAmelCase , _lowerCAmelCase ): raise TypeError('''only integers accepted as input''' ) else: __snake_case = str(abs(_lowerCAmelCase ) ) __snake_case = [l...
592
'''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
0
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax.numpy as jnp from jax import random from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .scheduling_utils_flax import FlaxSchedulerM...
262
'''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
0
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_MAPPING, AutoConfig, AutoModelWithLMHead, ...
6
'''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
0
"""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 from ...test_modeling...
7
'''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
0
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_common import TokenizerTesterMixi...
280
'''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
0
import copy import importlib.metadata import json import os from dataclasses import dataclass from typing import Any, Dict, Union from packaging import version from ..utils import is_torch_available, logging if is_torch_available(): import torch SCREAMING_SNAKE_CASE : Any = ...
257
'''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
0
import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class lowercase ( A__ ): ...
403
'''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
0
"""simple docstring""" import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig lowerCAmelCase_ = logging.get_logger(__name__) class __A : ...
560
'''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
0
def SCREAMING_SNAKE_CASE ( snake_case_ : str ): if not head: return True # split the list to two parts snake_case__ : str = head.next, head while fast and fast.next: snake_case__ : Optional[Any] = fast.next.next snake_case__ : Dict = slow.next snake_case__ ...
297
'''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
0
import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def snake_case (UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ) -> Optional[int]: UpperCamelCase_: Any = OmegaCo...
57
'''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
0
"""simple docstring""" def lowerCamelCase ( _snake_case ,_snake_case ,_snake_case ,_snake_case ): # Return True if there is node that has not iterated. UpperCAmelCase__ : List[Any] = [False] * len(_lowerCAmelCase ) UpperCAmelCase__ : Tuple = []...
110
'''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
0
import re def lowerCamelCase__ ( snake_case_ : str ) -> str: if len(re.findall('''[ATCG]''' , _lowerCAmelCase ) ) != len(_lowerCAmelCase ): raise ValueError('''Invalid Strand''' ) return dna.translate(dna.maketrans('''ATCG''' , '''TAGC''' ...
592
'''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
0
'''simple docstring''' import pytest from datasets.utils.sharding import _distribute_shards, _number_of_shards_in_gen_kwargs, _split_gen_kwargs @pytest.mark.parametrize( '''kwargs, expected''' , [ ({'''num_shards''': 0, '''max_num_jobs''': 1}, []), ({'''num_shards''':...
262
'''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
0
import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class UpperCamelCase_ ( unittest.TestCase ): def _snake_case ( self :Tuple ) -> Optional[Any]: """simple docstring""" SCREAMING_SNAKE_CASE__ = [ ...
6
'''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
0
"""simple docstring""" import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename a = "http://www.mocksite.co...
7
'''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
0
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 __magic_name__ : Tuple = { "facebook/maskformer-swi...
280
'''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
0
import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datasets.table import table_cast from datas...
257
'''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
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer _lowerCamelCase : str = logging.get_logger(__name__) _lowerCa...
403
'''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
0