import_utils#
- is_paddle_available() bool [源代码]#
check if
torch
package is installed :returns: iftorch
is available :rtype: bool
- is_torch_available() bool [源代码]#
check if
torch
package is installed :returns: iftorch
is available :rtype: bool
- is_package_available(package_name: str) bool [源代码]#
check if the package is avaliable :param package_name: the installed package name :type package_name: str
- 返回:
the existence of installed package
- 返回类型:
bool
- is_fast_tokenizer_available() bool [源代码]#
check if
fast_tokenizer
ia avaliable :returns: iffast_tokenizer
is avaliable :rtype: bool
- is_paddlenlp_ops_available() bool [源代码]#
check if
paddlenlp_ops
ia avaliable :returns: ifpaddlenlp_ops
is avaliable :rtype: bool
- is_transformers_available() bool [源代码]#
check if
transformers
package is installed :returns: iftransformers
is available :rtype: bool
- install_package(package_name: str, version: str | None = None, module_name: str | None = None, cache_dir: str | None = None)[源代码]#
install the specific version of package
- 参数:
package_name (str) -- the name of package
version (str) -- the version of package
module_name (str) -- the imported name of package
cache_dir (str) -- cache dir
- uninstall_package(package_name: str, module_name: str | None = None)[源代码]#
uninstall the pacakge from site-packages.
- To remove the cache of source package module & class & method, it should:
remove the source files of packages under the
site-packages
dir.remove the cache under the
locals()
remove the cache under the
sys.modules
- 参数:
package_name (str) -- the name of package