id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
18,528 | import importlib.util
import io
import json
import weakref
from copy import deepcopy
from functools import partialmethod
from .dependency_versions_check import dep_version_check
from .file_utils import is_torch_available
from .utils import logging
logger = logging.get_logger(__name__)
def deepspeed_optim_sched(trainer,... | Init DeepSpeed, after updating the DeepSpeed configuration with any relevant Trainer's args. If `resume_from_checkpoint` was passed then an attempt to resume from a previously saved checkpoint will be made. Args: trainer: Trainer object num_training_steps: per single gpu resume_from_checkpoint: path to a checkpoint if ... |
18,529 | import math
import torch
from packaging import version
from torch import nn
from .utils import logging
The provided code snippet includes necessary dependencies for implementing the `gelu_python` function. Write a Python function `def gelu_python(x)` to solve the following problem:
Original Implementation of the GELU ... | Original Implementation of the GELU activation function in Google BERT repo when initially created. For information: OpenAI GPT's GELU is slightly different (and gives slightly different results): 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3)))) This is now written in C in nn.functi... |
18,530 | import math
import torch
from packaging import version
from torch import nn
from .utils import logging
The provided code snippet includes necessary dependencies for implementing the `gelu_new` function. Write a Python function `def gelu_new(x)` to solve the following problem:
Implementation of the GELU activation func... | Implementation of the GELU activation function currently in Google BERT repo (identical to OpenAI GPT). Also see the Gaussian Error Linear Units paper: https://arxiv.org/abs/1606.08415 |
18,531 | import math
import torch
from packaging import version
from torch import nn
from .utils import logging
def gelu_fast(x):
return 0.5 * x * (1.0 + torch.tanh(x * 0.7978845608 * (1.0 + 0.044715 * x * x))) | null |
18,532 | import math
import torch
from packaging import version
from torch import nn
from .utils import logging
def quick_gelu(x):
return x * torch.sigmoid(1.702 * x) | null |
18,533 | import math
import torch
from packaging import version
from torch import nn
from .utils import logging
The provided code snippet includes necessary dependencies for implementing the `_silu_python` function. Write a Python function `def _silu_python(x)` to solve the following problem:
See Gaussian Error Linear Units (H... | See Gaussian Error Linear Units (Hendrycks et al., https://arxiv.org/abs/1606.08415) where the SiLU (Sigmoid Linear Unit) was originally introduced and coined, and see Sigmoid-Weighted Linear Units for Neural Network Function Approximation in Reinforcement Learning (Elfwing et al., https://arxiv.org/abs/1702.03118) and... |
18,534 | import math
import torch
from packaging import version
from torch import nn
from .utils import logging
The provided code snippet includes necessary dependencies for implementing the `_mish_python` function. Write a Python function `def _mish_python(x)` to solve the following problem:
See Mish: A Self-Regularized Non-M... | See Mish: A Self-Regularized Non-Monotonic Activation Function (Misra., https://arxiv.org/abs/1908.08681). Also visit the official repository for the paper: https://github.com/digantamisra98/Mish |
18,535 | import math
import torch
from packaging import version
from torch import nn
from .utils import logging
def linear_act(x):
return x | null |
18,536 | import math
import torch
from packaging import version
from torch import nn
from .utils import logging
ACT2FN = {
"relu": nn.functional.relu,
"silu": silu,
"swish": silu,
"gelu": gelu,
"tanh": torch.tanh,
"gelu_python": gelu_python,
"gelu_new": gelu_new,
"gelu_fast": gelu_fast,
"quic... | null |
18,537 | import importlib
import re
import warnings
from collections import OrderedDict
from typing import List, Union
from ...configuration_utils import PretrainedConfig
from ..file_utils import CONFIG_NAME
from ..utils import logging
from .dynamic import get_class_from_dynamic_module
CONFIG_MAPPING_NAMES = OrderedDict(
[
... | Converts a config class name to the corresponding model type |
18,538 | import importlib
import os
import re
import shutil
import sys
from pathlib import Path
from typing import Dict, Optional, Union
from ..file_utils import (
HF_MODULES_CACHE,
TRANSFORMERS_DYNAMIC_MODULE_NAME,
cached_path,
is_offline_mode,
)
from ..utils import logging
logger = logging.get_logger(__name__)... | Extracts a class from a module file, present in the local folder or repository of a model. <Tip warning={true}> Calling this function will execute the code in the module file found locally or downloaded from the Hub. It should therefore only be called on trusted repos. </Tip> Args: pretrained_model_name_or_path (`str` ... |
18,539 | import importlib
import os
from collections import OrderedDict
from ...configuration_utils import PretrainedConfig
from ..feature_extraction_utils import FeatureExtractionMixin
from ..file_utils import CONFIG_NAME, FEATURE_EXTRACTOR_NAME
from .auto_factory import _LazyAutoMapping
from .configuration_auto import (
C... | null |
18,540 | import importlib
from collections import OrderedDict
from ...configuration_utils import PretrainedConfig
from ..file_utils import copy_func
from ..utils import logging
from .configuration_auto import AutoConfig, model_type_to_module_name, replace_list_option_in_docstrings
from .dynamic import get_class_from_dynamic_mod... | null |
18,541 | import importlib
from collections import OrderedDict
from ...configuration_utils import PretrainedConfig
from ..file_utils import copy_func
from ..utils import logging
from .configuration_auto import AutoConfig, model_type_to_module_name, replace_list_option_in_docstrings
from .dynamic import get_class_from_dynamic_mod... | null |
18,542 | import importlib
from collections import OrderedDict
from ...configuration_utils import PretrainedConfig
from ..file_utils import copy_func
from ..utils import logging
from .configuration_auto import AutoConfig, model_type_to_module_name, replace_list_option_in_docstrings
from .dynamic import get_class_from_dynamic_mod... | null |
18,543 | import importlib
from collections import OrderedDict
from ...configuration_utils import PretrainedConfig
from ..file_utils import copy_func
from ..utils import logging
from .configuration_auto import AutoConfig, model_type_to_module_name, replace_list_option_in_docstrings
from .dynamic import get_class_from_dynamic_mod... | null |
18,544 | import importlib
import json
import os
from collections import OrderedDict
from typing import TYPE_CHECKING, Dict, Optional, Tuple, Union
from ...configuration_utils import PretrainedConfig
from ..file_utils import (
cached_path,
is_offline_mode,
is_sentencepiece_available,
is_tokenizers_available,
)
fr... | null |
18,545 | import importlib
import json
import os
from collections import OrderedDict
from typing import TYPE_CHECKING, Dict, Optional, Tuple, Union
from ...configuration_utils import PretrainedConfig
from ..file_utils import (
cached_path,
is_offline_mode,
is_sentencepiece_available,
is_tokenizers_available,
)
fr... | Loads the tokenizer configuration from a pretrained model tokenizer configuration. Args: pretrained_model_name_or_path (`str` or `os.PathLike`): This can be either: - a string, the *model id* of a pretrained model configuration hosted inside a model repo on huggingface.co. Valid model ids can be located at the root-lev... |
18,546 | import importlib
from collections import OrderedDict
from ...configuration_utils import PretrainedConfig
from ..feature_extraction_utils import FeatureExtractionMixin
from ..file_utils import CONFIG_NAME, FEATURE_EXTRACTOR_NAME, get_list_of_files
from .auto_factory import _LazyAutoMapping
from .configuration_auto impor... | null |
18,547 | import contextlib
import json
import math
import os
import warnings
from dataclasses import asdict, dataclass, field
from enum import Enum
from pathlib import Path
from typing import Any, Dict, List, Optional
from .debug_utils import DebugOption
from .file_utils import (
cached_property,
get_full_repo_name,
... | Same default as PyTorch |
18,548 | import copy
import json
import os
import re
import warnings
from collections import OrderedDict, UserDict
from contextlib import contextmanager
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, Sequence, Tuple, Union
import numpy as np
from packaging impor... | Get the tokenizer file to use for this version of transformers. Args: path_or_repo (`str` or `os.PathLike`): Can be either the id of a repo on huggingface.co or a path to a *directory*. revision(`str`, *optional*, defaults to `"main"`): This feature is deprecated. use_auth_token (`str` or *bool*, *optional*): The token... |
18,549 | import sys
from .dependency_versions_table import deps
from .utils.versions import require_version, require_version_core
deps = {
"Pillow": "Pillow",
"black": "black==21.4b0",
"codecarbon": "codecarbon==1.2.0",
"cookiecutter": "cookiecutter==1.7.2",
"dataclasses": "dataclasses",
"datasets": "da... | null |
18,550 | import copy
import functools
import gc
import inspect
import os
import random
import re
import threading
import time
from typing import Any, Dict, NamedTuple, Optional, Tuple, Union
import numpy as np
from .file_utils import (
ExplicitEnum,
is_psutil_available,
is_sagemaker_dp_enabled,
is_tf_available,
... | Helper function for reproducible behavior to set the seed in `random`, `numpy`, `torch` and/or `tf` (if installed). Args: seed (`int`): The seed to set. |
18,551 | import copy
import functools
import gc
import inspect
import os
import random
import re
import threading
import time
from typing import Any, Dict, NamedTuple, Optional, Tuple, Union
import numpy as np
from .file_utils import (
ExplicitEnum,
is_psutil_available,
is_sagemaker_dp_enabled,
is_tf_available,
... | null |
18,552 | import copy
import functools
import gc
import inspect
import os
import random
import re
import threading
import time
from typing import Any, Dict, NamedTuple, Optional, Tuple, Union
import numpy as np
from .file_utils import (
ExplicitEnum,
is_psutil_available,
is_sagemaker_dp_enabled,
is_tf_available,
... | The default objective to maximize/minimize when doing an hyperparameter search. It is the evaluation loss if no metrics are provided to the [`Trainer`], the sum of all metrics otherwise. Args: metrics (`Dict[str, float]`): The metrics returned by the evaluate method. Return: `float`: The objective to minimize or maximi... |
18,553 | import copy
import functools
import gc
import inspect
import os
import random
import re
import threading
import time
from typing import Any, Dict, NamedTuple, Optional, Tuple, Union
import numpy as np
from .file_utils import (
ExplicitEnum,
is_psutil_available,
is_sagemaker_dp_enabled,
is_tf_available,
... | null |
18,554 | import copy
import functools
import gc
import inspect
import os
import random
import re
import threading
import time
from typing import Any, Dict, NamedTuple, Optional, Tuple, Union
import numpy as np
from .file_utils import (
ExplicitEnum,
is_psutil_available,
is_sagemaker_dp_enabled,
is_tf_available,
... | null |
18,555 | import copy
import functools
import gc
import inspect
import os
import random
import re
import threading
import time
from typing import Any, Dict, NamedTuple, Optional, Tuple, Union
import numpy as np
from .file_utils import (
ExplicitEnum,
is_psutil_available,
is_sagemaker_dp_enabled,
is_tf_available,
... | null |
18,556 | import copy
import functools
import gc
import inspect
import os
import random
import re
import threading
import time
from typing import Any, Dict, NamedTuple, Optional, Tuple, Union
import numpy as np
from .file_utils import (
ExplicitEnum,
is_psutil_available,
is_sagemaker_dp_enabled,
is_tf_available,
... | Whether or not the current process is the local process, based on `xm.get_ordinal()` (for TPUs) first, then on `local_rank`. |
18,557 | import copy
import functools
import gc
import inspect
import os
import random
import re
import threading
import time
from typing import Any, Dict, NamedTuple, Optional, Tuple, Union
import numpy as np
from .file_utils import (
ExplicitEnum,
is_psutil_available,
is_sagemaker_dp_enabled,
is_tf_available,
... | Return the number of processes launched in parallel. Works with `torch.distributed` and TPUs. |
18,558 | import copy
import functools
import gc
import inspect
import os
import random
import re
import threading
import time
from typing import Any, Dict, NamedTuple, Optional, Tuple, Union
import numpy as np
from .file_utils import (
ExplicitEnum,
is_psutil_available,
is_sagemaker_dp_enabled,
is_tf_available,
... | Recursively calls `.item()` on the element of the dictionary passed |
18,559 | import copy
import functools
import gc
import inspect
import os
import random
import re
import threading
import time
from typing import Any, Dict, NamedTuple, Optional, Tuple, Union
import numpy as np
from .file_utils import (
ExplicitEnum,
is_psutil_available,
is_sagemaker_dp_enabled,
is_tf_available,
... | Return the number of arguments of the passed function, even if it's a partial function. |
18,560 | import random
import warnings
from dataclasses import dataclass
from typing import Any, Callable, Dict, List, NewType, Optional, Tuple, Union
from .file_utils import PaddingStrategy
from .tokenization_utils_base import BatchEncoding, PreTrainedTokenizerBase
InputDataClass = NewType("InputDataClass", Any)
def torch_defa... | Very simple data collator that simply collates batches of dict-like objects and performs special handling for potential keys named: - `label`: handles a single value (int or float) per object - `label_ids`: handles a list of values per object Does not do any additional preprocessing: property names of the input object ... |
18,561 | import random
import warnings
from dataclasses import dataclass
from typing import Any, Callable, Dict, List, NewType, Optional, Tuple, Union
from .file_utils import PaddingStrategy
from .tokenization_utils_base import BatchEncoding, PreTrainedTokenizerBase
The provided code snippet includes necessary dependencies for... | Collate `examples` into a batch, using the information in `tokenizer` for padding if necessary. |
18,562 | import random
import warnings
from dataclasses import dataclass
from typing import Any, Callable, Dict, List, NewType, Optional, Tuple, Union
from .file_utils import PaddingStrategy
from .tokenization_utils_base import BatchEncoding, PreTrainedTokenizerBase
The provided code snippet includes necessary dependencies for... | Collate `examples` into a batch, using the information in `tokenizer` for padding if necessary. |
18,563 | import random
import warnings
from dataclasses import dataclass
from typing import Any, Callable, Dict, List, NewType, Optional, Tuple, Union
from .file_utils import PaddingStrategy
from .tokenization_utils_base import BatchEncoding, PreTrainedTokenizerBase
The provided code snippet includes necessary dependencies for... | Collate `examples` into a batch, using the information in `tokenizer` for padding if necessary. |
18,564 | import random
import warnings
from dataclasses import dataclass
from typing import Any, Callable, Dict, List, NewType, Optional, Tuple, Union
from .file_utils import PaddingStrategy
from .tokenization_utils_base import BatchEncoding, PreTrainedTokenizerBase
def tolist(x):
if isinstance(x, list):
return x
... | null |
18,565 | import inspect
import os
import re
from contextlib import contextmanager
from dataclasses import dataclass
from functools import partial
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
import torch
from torch import Tensor, device, nn
from torch.nn import CrossEntropyLoss
from .activations imp... | Context manager to globally disable weight initialization to speed up loading large models. TODO(Patrick): Delete safety argument `_enable=True` at next major version. . |
18,566 | import inspect
import os
import re
from contextlib import contextmanager
from dataclasses import dataclass
from functools import partial
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
import torch
from torch import Tensor, device, nn
from torch.nn import CrossEntropyLoss
from .activations imp... | Finds the heads and their indices taking `already_pruned_heads` into account. Args: heads (`List[int]`): List of the indices of heads to prune. n_heads (`int`): The number of heads in the model. head_size (`int`): The size of each head. already_pruned_heads (`Set[int]`): A set of already pruned heads. Returns: `Tuple[S... |
18,567 | import inspect
import os
import re
from contextlib import contextmanager
from dataclasses import dataclass
from functools import partial
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
import torch
from torch import Tensor, device, nn
from torch.nn import CrossEntropyLoss
from .activations imp... | null |
18,568 | import inspect
import os
import re
from contextlib import contextmanager
from dataclasses import dataclass
from functools import partial
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
import torch
from torch import Tensor, device, nn
from torch.nn import CrossEntropyLoss
from .activations imp... | null |
18,569 | import inspect
import os
import re
from contextlib import contextmanager
from dataclasses import dataclass
from functools import partial
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
import torch
from torch import Tensor, device, nn
from torch.nn import CrossEntropyLoss
from .activations imp... | Recursively unwraps a model from potential containers (as used in distributed training). Args: model (`torch.nn.Module`): The model to unwrap. |
18,570 | import inspect
import os
import re
from contextlib import contextmanager
from dataclasses import dataclass
from functools import partial
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
import torch
from torch import Tensor, device, nn
from torch.nn import CrossEntropyLoss
from .activations imp... | Prune a Conv1D or linear layer to keep only entries in index. Used to remove heads. Args: layer (`Union[torch.nn.Linear, Conv1D]`): The layer to prune. index (`torch.LongTensor`): The indices to keep in the layer. dim (`int`, *optional*): The dimension on which to keep the indices. Returns: `torch.nn.Linear` or [`~mode... |
18,571 | import inspect
import os
import re
from contextlib import contextmanager
from dataclasses import dataclass
from functools import partial
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
import torch
from torch import Tensor, device, nn
from torch.nn import CrossEntropyLoss
from .activations imp... | This function chunks the `input_tensors` into smaller input tensor parts of size `chunk_size` over the dimension `chunk_dim`. It then applies a layer `forward_fn` to each chunk independently to save memory. If the `forward_fn` is independent across the `chunk_dim` this function will yield the same result as directly ap... |
18,572 | import warnings
from dataclasses import dataclass
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union
import torch
import torch.distributed as dist
from torch import nn
from .file_utils import ModelOutput
from .generation_beam_search import BeamScorer, BeamSearchScorer
from .generation_logits... | Filter a distribution of logits using top-k and/or nucleus (top-p) filtering Args: logits: logits distribution shape (batch size, vocabulary size) top_k (`int`, *optional*, defaults to 0): If > 0, only keep the top k tokens with highest probability (top-k filtering) top_p (`float`, *optional*, defaults to 1.0): If < 1.... |
18,573 | import bisect
import itertools
import re
import unicodedata
from collections import OrderedDict
from typing import Any, Dict, List, Optional, Tuple, Union, overload
from .file_utils import PaddingStrategy, TensorType, add_end_docstrings
from .tokenization_utils_base import (
ENCODE_KWARGS_DOCSTRING,
ENCODE_PLUS... | Checks whether the last character in text is one of a punctuation, control or whitespace character. |
18,574 | import bisect
import itertools
import re
import unicodedata
from collections import OrderedDict
from typing import Any, Dict, List, Optional, Tuple, Union, overload
from .file_utils import PaddingStrategy, TensorType, add_end_docstrings
from .tokenization_utils_base import (
ENCODE_KWARGS_DOCSTRING,
ENCODE_PLUS... | Checks whether the first character in text is one of a punctuation, control or whitespace character. |
18,575 | import bisect
import itertools
import re
import unicodedata
from collections import OrderedDict
from typing import Any, Dict, List, Optional, Tuple, Union, overload
from .file_utils import PaddingStrategy, TensorType, add_end_docstrings
from .tokenization_utils_base import (
ENCODE_KWARGS_DOCSTRING,
ENCODE_PLUS... | Inserts one token to an ordered list if it does not already exist. Note: token_list must be sorted. |
18,576 | import copy
import json
import os
import re
import warnings
from typing import Any, Dict, Optional, Tuple, Union
from .file_utils import (
CONFIG_NAME,
PushToHubMixin,
cached_path,
copy_func,
get_list_of_files,
is_offline_mode,
is_remote_url,
is_torch_available,
)
from .utils import logg... | Get the configuration file to use for this version of transformers. Args: path_or_repo (`str` or `os.PathLike`): Can be either the id of a repo on huggingface.co or a path to a *directory*. revision(`str`, *optional*, defaults to `"main"`): This feature is deperated. use_auth_token (`str` or *bool*, *optional*): This f... |
18,577 | import collections
import re
import time
from typing import Optional
import IPython.display as disp
from ..trainer_callback import TrainerCallback
from ..trainer_utils import IntervalStrategy
The provided code snippet includes necessary dependencies for implementing the `format_time` function. Write a Python function ... | Format `t` (in seconds) to (h):mm:ss |
18,578 | import collections
import re
import time
from typing import Optional
import IPython.display as disp
from ..trainer_callback import TrainerCallback
from ..trainer_utils import IntervalStrategy
def html_progress_bar(value, total, prefix, label, width=300):
# docstyle-ignore
return f"""
<div>
{prefix}
... | null |
18,579 | import collections
import re
import time
from typing import Optional
import IPython.display as disp
from ..trainer_callback import TrainerCallback
from ..trainer_utils import IntervalStrategy
The provided code snippet includes necessary dependencies for implementing the `text_to_html_table` function. Write a Python fu... | Put the texts in `items` in an HTML table. |
18,580 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
_pyctcdecode_availabl... | null |
18,581 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
_librosa_available = ... | null |
18,582 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_torch_availabl... | null |
18,583 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_torch_availabl... | null |
18,584 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_torch_availabl... | null |
18,585 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_torch_onnx_di... | null |
18,586 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
try:
_coloredlogs... | null |
18,587 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
_tf2onnx_available = ... | null |
18,588 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
_onnx_available = imp... | null |
18,589 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
_ftfy_available = imp... | null |
18,590 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
if _torch_available:
... | null |
18,591 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
_datasets_available =... | null |
18,592 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
_detectron2_available... | null |
18,593 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_rjieba_availa... | null |
18,594 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_psutil_availa... | null |
18,595 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_py3nvml_avail... | null |
18,596 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_apex_availabl... | null |
18,597 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
_faiss_available = im... | null |
18,598 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_scipy_availabl... | null |
18,599 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_sentencepiece... | null |
18,600 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_protobuf_avai... | null |
18,601 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_tokenizers_av... | null |
18,602 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_vision_availa... | null |
18,603 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_pytesseract_a... | null |
18,604 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_spacy_availab... | null |
18,605 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
import sys
sys.path... | null |
18,606 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
_scatter_available = ... | null |
18,607 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
_pytorch_quantization... | null |
18,608 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
_tensorflow_probabili... | null |
18,609 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_pandas_availa... | null |
18,610 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_sagemaker_dp_... | null |
18,611 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_sagemaker_mp_... | null |
18,612 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_training_run_... | null |
18,613 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
_soundfile_available ... | null |
18,614 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
_timm_available = imp... | null |
18,615 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
_torchaudio_available... | null |
18,616 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
_torchaudio_available... | null |
18,617 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
_phonemizer_available... | null |
18,618 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
if _torch_available:
... | null |
18,619 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
BACKENDS_MAPPING = Or... | null |
18,620 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_torch_availabl... | null |
18,621 | import importlib.util
import json
import os
import sys
from collections import OrderedDict
from functools import wraps
from itertools import chain
from types import ModuleType
from typing import Any
from packaging import version
from ..utils.versions import importlib_metadata
from . import logging
def is_tf_available()... | null |
18,622 | from collections import OrderedDict, UserDict
from contextlib import ExitStack
from dataclasses import fields
from enum import Enum
from typing import Any, ContextManager, List, Tuple
import numpy as np
from .import_utils import is_flax_available, is_tf_available, is_torch_available, is_torch_fx_proxy
def is_torch_ava... | Tests if `x` is a `torch.Tensor`, `tf.Tensor`, `jaxlib.xla_extension.DeviceArray` or `np.ndarray`. |
18,623 | from collections import OrderedDict, UserDict
from contextlib import ExitStack
from dataclasses import fields
from enum import Enum
from typing import Any, ContextManager, List, Tuple
import numpy as np
from .import_utils import is_flax_available, is_tf_available, is_torch_available, is_torch_fx_proxy
def _is_numpy(x)... | null |
18,624 | from collections import OrderedDict, UserDict
from contextlib import ExitStack
from dataclasses import fields
from enum import Enum
from typing import Any, ContextManager, List, Tuple
import numpy as np
from .import_utils import is_flax_available, is_tf_available, is_torch_available, is_torch_fx_proxy
def _is_torch_de... | null |
18,625 | from collections import OrderedDict, UserDict
from contextlib import ExitStack
from dataclasses import fields
from enum import Enum
from typing import Any, ContextManager, List, Tuple
import numpy as np
from .import_utils import is_flax_available, is_tf_available, is_torch_available, is_torch_fx_proxy
def _is_torch(x):... | Convert a TensorFlow tensor, PyTorch tensor, Numpy array or python list to a python list. |
18,626 | from collections import OrderedDict, UserDict
from contextlib import ExitStack
from dataclasses import fields
from enum import Enum
from typing import Any, ContextManager, List, Tuple
import numpy as np
from .import_utils import is_flax_available, is_tf_available, is_torch_available, is_torch_fx_proxy
def _is_torch(x):... | Convert a TensorFlow tensor, PyTorch tensor, Numpy array or python list to a Numpy array. |
18,627 | import logging
import os
import sys
import threading
from logging import CRITICAL
from logging import DEBUG
from logging import ERROR
from logging import FATAL
from logging import INFO
from logging import NOTSET
from logging import WARN
from logging import WARNING
from typing import Optional
_lock = threading.L... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.