code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "distilbert-base-uncased": "https://huggingface.co/distilbert-base-uncased...
273
from __future__ import annotations from typing import Any class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Tuple , UpperCAmelCase_ : int , UpperCAmelCase_ : int , UpperCAmelCase_ : float = 0) ->None: '''simple docstr...
273
1
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import ...
273
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def lowerCAmelCase_ ( __a , __a , __a ) -> List[str]: """simple docstring""" lowerCamelCase__: int =("dense.weight", "attention.self.query"...
273
1
import enum import shutil import sys __A , __A = shutil.get_terminal_size() __A = {"UP": "A", "DOWN": "B", "RIGHT": "C", "LEFT": "D"} class _SCREAMING_SNAKE_CASE ( enum.Enum ): '''simple docstring''' lowercase_ = 0 lowercase_ = 1 def lowerC...
273
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) __A = "▁" __A = {"vocab_...
273
1
from ..utils import DummyObject, requires_backends class _SCREAMING_SNAKE_CASE ( metaclass=__SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = ["torch", "torchsde"] def __init__(self : Union[str, Any] , *UpperCAmelCase_ : Dict , **UpperCAmelCas...
273
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import ( BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWit...
273
1
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) ...
273
from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class _SCREAMING_SNAKE_CASE ( __SCREAMIN...
273
1
import gc import math import unittest import torch from diffusers import UNetaDModel from diffusers.utils import floats_tensor, logging, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_modeling_common import ModelTesterMixin, UNetTesterMixin __...
273
def lowerCAmelCase_ ( __a , __a ) -> Tuple: """simple docstring""" assert x is not None assert y is not None lowerCamelCase__: Any =len(__a ) lowerCamelCase__: int =len(__a ) # declaring the array for storing the dp values lowerCamelCase__: L...
273
1
from __future__ import annotations from collections import namedtuple def lowerCAmelCase_ ( __a , __a , __a ) -> tuple: """simple docstring""" lowerCamelCase__: Any =namedtuple("result" , "name value" ) if (voltage, current, power).count(0 ) != 1:...
273
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleCho...
273
1
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A = {"configuration_focalnet": ["FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "FocalNetConfig"]} try: if not is_torch_available(): rai...
273
import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py __A = "src/transformers" # This is to make sure the transformers module...
273
1
from typing import TYPE_CHECKING from ...utils import _LazyModule __A = {"tokenization_byt5": ["ByT5Tokenizer"]} if TYPE_CHECKING: from .tokenization_byta import ByTaTokenizer else: import sys __A = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__sp...
273
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger __A = get_logger(__name__) class _SCREAMING_SNAKE_CASE ( enum.Enum ): '''simple docstring''' lowercase_ = "all_checks" lowercase_ = ...
273
1
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import ( BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWit...
273
from __future__ import annotations def lowerCAmelCase_ ( __a , __a ) -> List[Any]: """simple docstring""" print(F"""Vertex\tShortest Distance from vertex {src}""" ) for i, d in enumerate(__a ): print(F"""{i}\t\t{d}""" ) def lowerCAmelCase_ ( __a , ...
273
1
import os import sys import warnings from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen from ..table imp...
273
from ..utils import DummyObject, requires_backends class _SCREAMING_SNAKE_CASE ( metaclass=__SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = ["torch", "torchsde"] def __init__(self : Union[str, Any] , *UpperCAmelCase_ : Dict , **UpperCAmelCas...
273
1
from ... import PretrainedConfig __A = { "sijunhe/nezha-cn-base": "https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json", } class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = NEZHA_PRETRAINED_CONFIG_ARCHIVE_...
273
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE , unittest.TestCase ): '''simple do...
273
1
import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ASTConfig from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_torchaudio_available from ...test_con...
273
from math import pow def lowerCAmelCase_ ( __a , __a , __a , __a , __a , ) -> tuple[int, int]: """simple docstring""" if current_sum == needed_sum: # If the sum of the powers is equal to needed_sum, then we have a solution. solutions_count += ...
273
1
import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Union[str, Any] , UpperCAmelCase_ : int=2 , UpperCAmelCase_ :...
273
import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_available, ) from transformers.testing_utils imp...
273
1
import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger __A = get_logger(__name__) __A = R"\n Args:\n input_ids (`jnp.ndarray` of shape `(batch_size, sequence_length)`):\n Indic...
273
def lowerCAmelCase_ ( __a ) -> str: """simple docstring""" if isinstance(__a , __a ): raise TypeError("'float' object cannot be interpreted as an integer" ) if isinstance(__a , __a ): raise TypeError("'str' object cannot be interpreted as an integer" ) if ...
273
1
import os import sys import unittest __A = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import get_test_info # noqa: E402 from get_test_info import ( # noqa: E402 get_model_to_test_mapping, get_model_to_teste...
273
import argparse import logging import pickle from collections import Counter logging.basicConfig( format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", datefmt="%m/%d/%Y %H:%M:%S", level=logging.INFO ) __A = logging.getLogger(__name__) if __name__ == "__main__": __A = argparse.A...
273
1
# XXX: we want transformers master here - in the absense of conftest manipulating sys.path: # hack it in for now: import sys from pathlib import Path __A = Path(__file__).resolve().parents[3] / "src" sys.path.insert(1, str(git_repo_path)) import dataclasses # noqa import io # noqa import itertools # ...
273
from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_available(): imp...
273
1
import argparse from argparse import Namespace import torch from torch import nn from transformers import XGLMConfig, XGLMForCausalLM def lowerCAmelCase_ ( __a ) -> Optional[int]: """simple docstring""" lowerCamelCase__: Union[str, Any] =[ "decoder.version", ...
273
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "distilbert-base-uncased": "https://huggingface.co/distilbert-base-uncased...
273
1
from __future__ import annotations import unittest from transformers import DebertaVaConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask...
273
from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_common import ConfigTester...
273
1
from __future__ import annotations def lowerCAmelCase_ ( __a ) -> list[int]: """simple docstring""" lowerCamelCase__: Optional[Any] =[True] * limit lowerCamelCase__: List[Any] =False lowerCamelCase__: Any =False lowerCamelCase__: Tuple ...
273
import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate.utils import patch_envi...
273
1
import os import unicodedata 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 __A = logging.get_logger(__name__) __A = {"vocab_file": "spiece....
273
from __future__ import annotations from typing import Any class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Any , UpperCAmelCase_ : int) ->None: '''simple docstring''' lowerCamelCase__: int =num_of_nodes lowerCamelCase__...
273
1
import argparse import json from pathlib import Path import torch import torchaudio from datasets import load_dataset from huggingface_hub import hf_hub_download from transformers import ASTConfig, ASTFeatureExtractor, ASTForAudioClassification from transformers.utils import logging logging.set_verbosity_info...
273
from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def lowerCAmelCase_ ( __a ) -> int: """simple docstring""" return ConvertCommand( args.model_type , args.tf_checkpoint , args.pytorch_dump_output...
273
1
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor __A = logging.get_logger(__name__) class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__(self : Tuple , *UpperCAmelCase_ :...
273
from __future__ import annotations from typing import Any class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Tuple , UpperCAmelCase_ : int , UpperCAmelCase_ : int , UpperCAmelCase_ : float = 0) ->None: '''simple docstr...
273
1
import argparse import logging import os from datetime import datetime import numpy as np import torch from torch import nn from torch.utils.data import DataLoader, RandomSampler, TensorDataset from tqdm import tqdm from transformers import GPTaLMHeadModel __A = logging.getLogger(__name__) def ...
273
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def lowerCAmelCase_ ( __a , __a , __a ) -> List[str]: """simple docstring""" lowerCamelCase__: int =("dense.weight", "attention.self.query"...
273
1
import json import os from dataclasses import dataclass from functools import partial from typing import Callable import flax.linen as nn import jax import jax.numpy as jnp import joblib import optax import wandb from flax import jax_utils, struct, traverse_util from flax.serialization import from_bytes, to_byte...
273
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) __A = "▁" __A = {"vocab_...
273
1
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A = { "configuration_autoformer": [ "AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "AutoformerConfig", ], } try: if not ...
273
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import ( BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWit...
273
1
from __future__ import annotations import pandas as pd def lowerCAmelCase_ ( __a , __a , __a ) -> list[int]: """simple docstring""" lowerCamelCase__: Any =[0] * no_of_processes lowerCamelCase__: Any =[0] * no_of_processes # Copy the burst time...
273
from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class _SCREAMING_SNAKE_CASE ( __SCREAMIN...
273
1
# this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git won't be considered # sinc...
273
def lowerCAmelCase_ ( __a , __a ) -> Tuple: """simple docstring""" assert x is not None assert y is not None lowerCamelCase__: Any =len(__a ) lowerCamelCase__: int =len(__a ) # declaring the array for storing the dp values lowerCamelCase__: L...
273
1
import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters __A = (720, 1280) # Height, Width __A = (0.4, 0.6) # if height or width lower than this scale, drop it. __A = 1 / 100 __A = "" __A = "" __A = "" ...
273
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleCho...
273
1
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor __A = logging.get_logger(__name__) class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__(self : List[str] , *UpperCAmelCase_ ...
273
import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py __A = "src/transformers" # This is to make sure the transformers module...
273
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A = { "configuration_megatron_bert": ["MEGATRON_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "MegatronBertConfig"], } try: if not is_torch_available(): raise OptionalDepend...
273
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger __A = get_logger(__name__) class _SCREAMING_SNAKE_CASE ( enum.Enum ): '''simple docstring''' lowercase_ = "all_checks" lowercase_ = ...
273
1
import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import ( is_pipeline_test, ...
273
from __future__ import annotations def lowerCAmelCase_ ( __a , __a ) -> List[Any]: """simple docstring""" print(F"""Vertex\tShortest Distance from vertex {src}""" ) for i, d in enumerate(__a ): print(F"""{i}\t\t{d}""" ) def lowerCAmelCase_ ( __a , ...
273
1
def lowerCAmelCase_ ( __a ) -> set: """simple docstring""" lowerCamelCase__: Optional[Any] =set() # edges = list of graph's edges lowerCamelCase__: Tuple =get_edges(__a ) # While there are still elements in edges list, take an arbitrary edge # (from_node,...
273
from ..utils import DummyObject, requires_backends class _SCREAMING_SNAKE_CASE ( metaclass=__SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = ["torch", "torchsde"] def __init__(self : Union[str, Any] , *UpperCAmelCase_ : Dict , **UpperCAmelCas...
273
1
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=__SCREAMING_SNAKE_CASE ) class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = ...
273
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE , unittest.TestCase ): '''simple do...
273
1
import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_common import SequenceFe...
273
from math import pow def lowerCAmelCase_ ( __a , __a , __a , __a , __a , ) -> tuple[int, int]: """simple docstring""" if current_sum == needed_sum: # If the sum of the powers is equal to needed_sum, then we have a solution. solutions_count += ...
273
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __A = {"configuration_swin": ["SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP", "SwinConfig", "SwinOnnxConfig"]} try: if not is_torch_available(): raise OptionalDep...
273
import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_available, ) from transformers.testing_utils imp...
273
1
import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer __A = logging.get_logger(__n...
273
def lowerCAmelCase_ ( __a ) -> str: """simple docstring""" if isinstance(__a , __a ): raise TypeError("'float' object cannot be interpreted as an integer" ) if isinstance(__a , __a ): raise TypeError("'str' object cannot be interpreted as an integer" ) if ...
273
1
import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate.utils import patch_envi...
273
import argparse import logging import pickle from collections import Counter logging.basicConfig( format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", datefmt="%m/%d/%Y %H:%M:%S", level=logging.INFO ) __A = logging.getLogger(__name__) if __name__ == "__main__": __A = argparse.A...
273
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __A = { "configuration_pix2struct": [ "PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP", "Pix2StructConfig", "Pix2StructTextConfig", "Pi...
273
from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_available(): imp...
273
1
import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ,...
273
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "distilbert-base-uncased": "https://huggingface.co/distilbert-base-uncased...
273
1
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE , unittest.TestCase ): '''simple do...
273
from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_common import ConfigTester...
273
1
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
273
import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate.utils import patch_envi...
273
1
from datetime import datetime import requests def lowerCAmelCase_ ( __a ) -> bytes: """simple docstring""" lowerCamelCase__: List[str] ="https://downloadgram.net/wp-json/wppress/video-downloader/video?url=" lowerCamelCase__: Optional[Any] =requests.get(base...
273
from __future__ import annotations from typing import Any class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Any , UpperCAmelCase_ : int) ->None: '''simple docstring''' lowerCamelCase__: int =num_of_nodes lowerCamelCase__...
273
1
import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code from ...ima...
273
from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def lowerCAmelCase_ ( __a ) -> int: """simple docstring""" return ConvertCommand( args.model_type , args.tf_checkpoint , args.pytorch_dump_output...
273
1
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 Conf...
273
from __future__ import annotations from typing import Any class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Tuple , UpperCAmelCase_ : int , UpperCAmelCase_ : int , UpperCAmelCase_ : float = 0) ->None: '''simple docstr...
273
1
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from transformers import TensorFlowBenchmark, TensorFlowBenchmarkArguments @requi...
273
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def lowerCAmelCase_ ( __a , __a , __a ) -> List[str]: """simple docstring""" lowerCamelCase__: int =("dense.weight", "attention.self.query"...
273
1
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": 10, "max_num_jobs": 1}, [range(10 )]), ({"n...
273
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) __A = "▁" __A = {"vocab_...
273
1
def lowerCAmelCase_ ( __a ) -> bool: """simple docstring""" if not isinstance(__a , __a ): lowerCamelCase__: Optional[Any] =F"""Input value of [number={number}] must be an integer""" raise TypeError(__a ) if number < 0: return False lowerCamelCase__: ...
273
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import ( BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWit...
273
1
from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "facebook/vit-mae-base": "https://huggingface.co/facebook/vit-mae-base/resolve/main/config.json", # See all ViT MAE models at https://huggingface.co/models?filter=vi...
273
from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class _SCREAMING_SNAKE_CASE ( __SCREAMIN...
273
1
import builtins import sys from ...utils.imports import _is_package_available from . import cursor, input from .helpers import Direction, clear_line, forceWrite, linebreak, move_cursor, reset_cursor, writeColor from .keymap import KEYMAP __A = False try: __A = _is_package_available("google.c...
273
def lowerCAmelCase_ ( __a , __a ) -> Tuple: """simple docstring""" assert x is not None assert y is not None lowerCamelCase__: Any =len(__a ) lowerCamelCase__: int =len(__a ) # declaring the array for storing the dp values lowerCamelCase__: L...
273
1
from __future__ import annotations def lowerCAmelCase_ ( __a ) -> list[int]: """simple docstring""" lowerCamelCase__: str =2 lowerCamelCase__: Tuple =[] while i * i <= n: if n % i: i += 1 else: n //= i factors.append(__a ) if n...
273
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleCho...
273
1
__A = {str(digit): digit**5 for digit in range(10)} def lowerCAmelCase_ ( __a ) -> int: """simple docstring""" return sum(DIGITS_FIFTH_POWER[digit] for digit in str(__a ) ) def lowerCAmelCase_ ( ) -> int: """simple docstring""" return sum...
273
import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py __A = "src/transformers" # This is to make sure the transformers module...
273
1
import argparse from tax import checkpoints from transformers import AutoConfig, FlaxAutoModelForSeqaSeqLM def lowerCAmelCase_ ( __a , __a , __a ) -> Dict: """simple docstring""" lowerCamelCase__: List[Any] =AutoConfig.from_pretrained(__a ) lowerCamelCa...
273
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger __A = get_logger(__name__) class _SCREAMING_SNAKE_CASE ( enum.Enum ): '''simple docstring''' lowercase_ = "all_checks" lowercase_ = ...
273
1
def lowerCAmelCase_ ( __a ) -> list[int]: """simple docstring""" if length <= 0 or not isinstance(__a , __a ): raise ValueError("Length must be a positive integer." ) return [n * (2 * n - 1) for n in range(__a )] if __name__ == "__main__": print(hexagonal_numbers...
273
from __future__ import annotations def lowerCAmelCase_ ( __a , __a ) -> List[Any]: """simple docstring""" print(F"""Vertex\tShortest Distance from vertex {src}""" ) for i, d in enumerate(__a ): print(F"""{i}\t\t{d}""" ) def lowerCAmelCase_ ( __a , ...
273
1
import math def lowerCAmelCase_ ( ) -> None: """simple docstring""" lowerCamelCase__: Optional[int] =input("Enter message: " ) lowerCamelCase__: Dict =int(input(F"""Enter key [2-{len(__a ) - 1}]: """ ) ) lowerCamelCase__: Dict =input("Encrypti...
273
from ..utils import DummyObject, requires_backends class _SCREAMING_SNAKE_CASE ( metaclass=__SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = ["torch", "torchsde"] def __init__(self : Union[str, Any] , *UpperCAmelCase_ : Dict , **UpperCAmelCas...
273
1
from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def lowerCAmelCase_ ( __a ) -> int: """simple docstring""" return ConvertCommand( args.model_type , args.tf_checkpoint , args.pytorch_dump_output...
273
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE , unittest.TestCase ): '''simple do...
273
1
import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py __A = "src/transformers" # This is to make sure the transformers module...
273
from math import pow def lowerCAmelCase_ ( __a , __a , __a , __a , __a , ) -> tuple[int, int]: """simple docstring""" if current_sum == needed_sum: # If the sum of the powers is equal to needed_sum, then we have a solution. solutions_count += ...
273
1
import math from numpy import inf from scipy.integrate import quad def lowerCAmelCase_ ( __a ) -> float: """simple docstring""" if num <= 0: raise ValueError("math domain error" ) return quad(__a , 0 , __a , args=(__a) )[0] def lowerCAmelCase...
273
import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_available, ) from transformers.testing_utils imp...
273
1
from __future__ import annotations from collections.abc import Callable def lowerCAmelCase_ ( __a , __a , __a , __a = 100 , ) -> float: """simple docstring""" lowerCamelCase__: Union[str, Any] =x_start lowerCamelCase__: List[str] =fnc...
273
def lowerCAmelCase_ ( __a ) -> str: """simple docstring""" if isinstance(__a , __a ): raise TypeError("'float' object cannot be interpreted as an integer" ) if isinstance(__a , __a ): raise TypeError("'str' object cannot be interpreted as an integer" ) if ...
273
1
import os import re import sys import traceback import warnings from pathlib import Path from typing import Dict, Optional, Union from uuid import uuida from huggingface_hub import HfFolder, ModelCard, ModelCardData, hf_hub_download, whoami from huggingface_hub.file_download import REGEX_COMMIT_HASH from hugging...
273
import argparse import logging import pickle from collections import Counter logging.basicConfig( format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", datefmt="%m/%d/%Y %H:%M:%S", level=logging.INFO ) __A = logging.getLogger(__name__) if __name__ == "__main__": __A = argparse.A...
273
1
from __future__ import annotations def lowerCAmelCase_ ( __a , __a , __a ) -> int | float: """simple docstring""" if len(__a ) == 0: raise ValueError("find_max() arg is an empty sequence" ) if ( left >= len(__a ) or left < -len(__a ) or rig...
273
from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_available(): imp...
273
1
def lowerCAmelCase_ ( __a ) -> str: """simple docstring""" if isinstance(__a , __a ): raise TypeError("'float' object cannot be interpreted as an integer" ) if isinstance(__a , __a ): raise TypeError("'str' object cannot be interpreted as an integer" ) if ...
273
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "distilbert-base-uncased": "https://huggingface.co/distilbert-base-uncased...
273
1
def lowerCAmelCase_ ( __a ) -> bool: """simple docstring""" return str(__a ) == str(__a )[::-1] def lowerCAmelCase_ ( __a ) -> int: """simple docstring""" return int(__a ) + int(str(__a )[::-1] ) def lowerCAmelCase_ ( __a = 10000 ) ...
273
from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_common import ConfigTester...
273
1
import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import AdamW from torch.utils.data import Dat...
273
import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate.utils import patch_envi...
273
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) __A = "▁" __A = {"vocab_...
273
from __future__ import annotations from typing import Any class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Any , UpperCAmelCase_ : int) ->None: '''simple docstring''' lowerCamelCase__: int =num_of_nodes lowerCamelCase__...
273
1
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger __A = get_logger(__name__) class _SCREAMING_SNAKE_CASE ( enum.Enum ): '''simple docstring''' lowercase_ = "all_checks" lowercase_ = ...
273
from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def lowerCAmelCase_ ( __a ) -> int: """simple docstring""" return ConvertCommand( args.model_type , args.tf_checkpoint , args.pytorch_dump_output...
273
1
from math import sqrt def lowerCAmelCase_ ( __a ) -> bool: """simple docstring""" 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 even numbers, all multiples of 3 are not primes re...
273
from __future__ import annotations from typing import Any class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Tuple , UpperCAmelCase_ : int , UpperCAmelCase_ : int , UpperCAmelCase_ : float = 0) ->None: '''simple docstr...
273
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A = { "configuration_git": ["GIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "GitConfig", "GitVisionConfig"], "processing_git": ["GitProcessor"], } try: if not is_torch_available(): ...
273
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def lowerCAmelCase_ ( __a , __a , __a ) -> List[str]: """simple docstring""" lowerCamelCase__: int =("dense.weight", "attention.self.query"...
273
1
__A = 256 # Modulus to hash a string __A = 100_0003 def lowerCAmelCase_ ( __a , __a ) -> bool: """simple docstring""" lowerCamelCase__: Tuple =len(__a ) lowerCamelCase__: Union[str, Any] =len(__a ) if p_len > t_len: return False ...
273
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) __A = "▁" __A = {"vocab_...
273
1
import os import textwrap import pyarrow as pa import pytest from datasets import ClassLabel, Features, Image from datasets.packaged_modules.csv.csv import Csv from ..utils import require_pil @pytest.fixture def lowerCAmelCase_ ( __a ) -> List[str]: """simple docstring""" lowe...
273
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import ( BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWit...
273
1
import os import unittest from transformers import FunnelTokenizer, FunnelTokenizerFast from transformers.models.funnel.tokenization_funnel import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers class...
273
from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class _SCREAMING_SNAKE_CASE ( __SCREAMIN...
273
1
import tempfile import unittest from transformers import TaConfig, is_torch_available from transformers.testing_utils import ( require_sentencepiece, require_tokenizers, require_torch, slow, torch_device, ) from ...generation.test_utils import GenerationTesterMixin from ...test_modeling_comm...
273
def lowerCAmelCase_ ( __a , __a ) -> Tuple: """simple docstring""" assert x is not None assert y is not None lowerCamelCase__: Any =len(__a ) lowerCamelCase__: int =len(__a ) # declaring the array for storing the dp values lowerCamelCase__: L...
273
1
from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFMo...
273
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleCho...
273
1
from typing import Optional, Tuple, Union import tensorflow as tf from ...activations_tf import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward from ...modeling_tf_outputs import ( TFBaseModelOutputWithNoAttention, TFBaseModelOutpu...
273
import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py __A = "src/transformers" # This is to make sure the transformers module...
273
1
import darl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline __A = { "n_samples": 64, "horizon": 32, "num_inference_steps": 20, "n_guide_steps": 2, # can set to 0 for faster sampling, does not use value network "scale_grad_by_std": True, "sc...
273
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger __A = get_logger(__name__) class _SCREAMING_SNAKE_CASE ( enum.Enum ): '''simple docstring''' lowercase_ = "all_checks" lowercase_ = ...
273
1
from ...processing_utils import ProcessorMixin class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = "SpeechT5FeatureExtractor" lowercase_ = "SpeechT5Tokenizer" def __init__(self : Dict , UpperCAmelCase_ : Any ,...
273
from __future__ import annotations def lowerCAmelCase_ ( __a , __a ) -> List[Any]: """simple docstring""" print(F"""Vertex\tShortest Distance from vertex {src}""" ) for i, d in enumerate(__a ): print(F"""{i}\t\t{d}""" ) def lowerCAmelCase_ ( __a , ...
273
1
from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tens...
273
from ..utils import DummyObject, requires_backends class _SCREAMING_SNAKE_CASE ( metaclass=__SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = ["torch", "torchsde"] def __init__(self : Union[str, Any] , *UpperCAmelCase_ : Dict , **UpperCAmelCas...
273
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A = { "configuration_roformer": ["ROFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "RoFormerConfig...
273
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE , unittest.TestCase ): '''simple do...
273
1
def lowerCAmelCase_ ( __a , __a ) -> float: """simple docstring""" if discount_rate < 0: raise ValueError("Discount rate cannot be negative" ) if not cash_flows: raise ValueError("Cash flows list cannot be empty" ) lowerCamelCase__: int =sum( cash_f...
273
from math import pow def lowerCAmelCase_ ( __a , __a , __a , __a , __a , ) -> tuple[int, int]: """simple docstring""" if current_sum == needed_sum: # If the sum of the powers is equal to needed_sum, then we have a solution. solutions_count += ...
273
1
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"): __A = { "linear": PIL.Image.Resampling.BILINEAR, "bilinear": PIL.Image.Resampling.BILINEAR, "bi...
273
import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_available, ) from transformers.testing_utils imp...
273
1
from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.config import PatchingSpec from ...token...
273
def lowerCAmelCase_ ( __a ) -> str: """simple docstring""" if isinstance(__a , __a ): raise TypeError("'float' object cannot be interpreted as an integer" ) if isinstance(__a , __a ): raise TypeError("'str' object cannot be interpreted as an integer" ) if ...
273
1
import json import os import unittest from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES, XLMTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE , un...
273
import argparse import logging import pickle from collections import Counter logging.basicConfig( format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", datefmt="%m/%d/%Y %H:%M:%S", level=logging.INFO ) __A = logging.getLogger(__name__) if __name__ == "__main__": __A = argparse.A...
273
1
from __future__ import annotations from typing import Any class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Tuple , UpperCAmelCase_ : int , UpperCAmelCase_ : int , UpperCAmelCase_ : float = 0) ->None: '''simple docstr...
273
from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_available(): imp...
273
1
from __future__ import annotations import requests def lowerCAmelCase_ ( __a ) -> dict: """simple docstring""" lowerCamelCase__: Optional[int] =F"""https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty""" return requests.get(__a ).json() def ...
273
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "distilbert-base-uncased": "https://huggingface.co/distilbert-base-uncased...
273
1
from collections.abc import Generator from math import sin def lowerCAmelCase_ ( __a ) -> bytes: """simple docstring""" if len(__a ) != 32: raise ValueError("Input must be of length 32" ) lowerCamelCase__: Optional[Any] =b"" for i in [3, 2, 1, 0]: little_...
273
from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_common import ConfigTester...
273
1
import unittest from transformers import DebertaVaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor ...
273
import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate.utils import patch_envi...
273
1
import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, TrainerCallback, TrainingArgum...
273
from __future__ import annotations from typing import Any class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Any , UpperCAmelCase_ : int) ->None: '''simple docstring''' lowerCamelCase__: int =num_of_nodes lowerCamelCase__...
273
1
from __future__ import annotations def lowerCAmelCase_ ( __a = 4 ) -> list[list[int]]: """simple docstring""" lowerCamelCase__: int =abs(__a ) or 4 return [[1 + x + y * row_size for x in range(__a )] for y in range(__a )] def lowerCAmelCase_ ( __a ) ...
273
from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def lowerCAmelCase_ ( __a ) -> int: """simple docstring""" return ConvertCommand( args.model_type , args.tf_checkpoint , args.pytorch_dump_output...
273
1
import cva import numpy as np class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Tuple , UpperCAmelCase_ : float , UpperCAmelCase_ : int) ->List[Any]: '''simple docstring''' if k in (0.04, 0.06): lowerCamelCase__: in...
273
from __future__ import annotations from typing import Any class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Tuple , UpperCAmelCase_ : int , UpperCAmelCase_ : int , UpperCAmelCase_ : float = 0) ->None: '''simple docstr...
273
1
def lowerCAmelCase_ ( __a = 100 ) -> int: """simple docstring""" lowerCamelCase__: str =(n * (n + 1) // 2) ** 2 lowerCamelCase__: Union[str, Any] =n * (n + 1) * (2 * n + 1) // 6 return sum_cubes - sum_squares if __name__ == "__main__": print(f'{solution(...
273
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def lowerCAmelCase_ ( __a , __a , __a ) -> List[str]: """simple docstring""" lowerCamelCase__: int =("dense.weight", "attention.self.query"...
273
1
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface import Hug...
273
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) __A = "▁" __A = {"vocab_...
273
1
from __future__ import annotations def lowerCAmelCase_ ( __a , __a , __a , __a ) -> list: """simple docstring""" lowerCamelCase__: List[Any] =[] lowerCamelCase__ , lowerCamelCase__: Dict =input_list[low:mid], input_list[mid : high + 1] w...
273
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import ( BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWit...
273
1
from __future__ import annotations import math def lowerCAmelCase_ ( __a , __a ) -> list: """simple docstring""" if len(__a ) != 2 or len(a[0] ) != 2 or len(__a ) != 2 or len(b[0] ) != 2: raise Exception("Matrices are not 2x2" ) lowerCamelCase__: Any =...
273
from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class _SCREAMING_SNAKE_CASE ( __SCREAMIN...
273
1
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) from transformers.testing_utils import DUMMY_UNKNOWN_ID...
273
def lowerCAmelCase_ ( __a , __a ) -> Tuple: """simple docstring""" assert x is not None assert y is not None lowerCamelCase__: Any =len(__a ) lowerCamelCase__: int =len(__a ) # declaring the array for storing the dp values lowerCamelCase__: L...
273
1
import itertools from dataclasses import dataclass from typing import Optional import pandas as pd import pyarrow as pa import datasets from datasets.table import table_cast @dataclass class _SCREAMING_SNAKE_CASE ( datasets.BuilderConfig ): '''simple docstring''' lowercase_ = ...
273
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleCho...
273
1
import unittest from typing import Tuple import torch from diffusers.utils import floats_tensor, randn_tensor, torch_all_close, torch_device from diffusers.utils.testing_utils import require_torch @require_torch class _SCREAMING_SNAKE_CASE : '''simple docstring''' @property def ...
273
import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py __A = "src/transformers" # This is to make sure the transformers module...
273
1
import io import json import unittest from parameterized import parameterized from transformers import FSMTForConditionalGeneration, FSMTTokenizer from transformers.testing_utils import get_tests_dir, require_torch, slow, torch_device from utils import calculate_bleu __A = get_tests_dir() + "/test_data...
273
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger __A = get_logger(__name__) class _SCREAMING_SNAKE_CASE ( enum.Enum ): '''simple docstring''' lowercase_ = "all_checks" lowercase_ = ...
273
1
import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow if is_torch_available(): import torch from transformers import XLMRobertaModel @require_sentencepiece @require_tokenizers @require_torc...
273
from __future__ import annotations def lowerCAmelCase_ ( __a , __a ) -> List[Any]: """simple docstring""" print(F"""Vertex\tShortest Distance from vertex {src}""" ) for i, d in enumerate(__a ): print(F"""{i}\t\t{d}""" ) def lowerCAmelCase_ ( __a , ...
273
1
import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ConvNextConfig, UperNetConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import is_torch_available, is_vision_availab...
273
from ..utils import DummyObject, requires_backends class _SCREAMING_SNAKE_CASE ( metaclass=__SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = ["torch", "torchsde"] def __init__(self : Union[str, Any] , *UpperCAmelCase_ : Dict , **UpperCAmelCas...
273
1
def lowerCAmelCase_ ( __a ) -> str: """simple docstring""" lowerCamelCase__: Optional[Any] =0 # if input_string is "aba" than new_input_string become "a|b|a" lowerCamelCase__: str ="" lowerCamelCase__: Any ="" # append each character + "|" in ne...
273
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE , unittest.TestCase ): '''simple do...
273
1