import_utils¶
-
is_paddle_available
() → bool[source]¶ check if
torch
package is installed :returns: iftorch
is available :rtype: bool
-
is_torch_available
() → bool[source]¶ check if
torch
package is installed :returns: iftorch
is available :rtype: bool
-
is_package_available
(package_name: str) → bool[source]¶ check if the package is avaliable :param package_name: the installed package name :type package_name: str
- Returns
the existence of installed package
- Return type
bool
-
is_fast_tokenizer_available
() → bool[source]¶ check if
fast_tokenizer
ia avaliable :returns: iffast_tokenizer
is avaliable :rtype: bool
-
is_transformers_available
() → bool[source]¶ check if
transformers
package is installed :returns: iftransformers
is available :rtype: bool
-
install_package
(package_name: str, version: Optional[str] = None, module_name: Optional[str] = None, cache_dir: Optional[str] = None)[source]¶ install the specific version of package
- Parameters
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: Optional[str] = None)[source]¶ 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
- Parameters
package_name (str) – the name of package