[Feature]add file to verify install and check env #issue#168 (#199)
* add file to verify install and env * add openvino and ppl * fix comment * add __version__ * fix comment * resolve comment * fix lintpull/12/head
parent
8a3e5e0464
commit
75fc0bde64
|
@ -1,6 +1,8 @@
|
|||
import importlib
|
||||
import logging
|
||||
|
||||
from .version import __version__ # noqa F401
|
||||
|
||||
importlib.import_module('mmdeploy.pytorch')
|
||||
|
||||
if importlib.util.find_spec('mmcv'):
|
||||
|
|
|
@ -26,3 +26,5 @@ def parse_version_info(version_str: str) -> Tuple:
|
|||
|
||||
|
||||
version_info = parse_version_info(__version__)
|
||||
|
||||
__all__ = ['__version__', 'version_info', 'parse_version_info']
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
import logging
|
||||
|
||||
from mmcv.utils import collect_env as collect_base_env
|
||||
from mmcv.utils import get_git_hash
|
||||
|
||||
import mmdeploy
|
||||
|
||||
|
||||
def collect_env():
|
||||
"""Collect the information of the running environments."""
|
||||
env_info = collect_base_env()
|
||||
env_info['MMDeployment'] = f'{mmdeploy.__version__}+{get_git_hash()[:7]}'
|
||||
|
||||
return env_info
|
||||
|
||||
|
||||
def check_backend():
|
||||
try:
|
||||
import onnxruntime as ort
|
||||
except ImportError:
|
||||
ort_version = None
|
||||
else:
|
||||
ort_version = ort.__version__
|
||||
import mmdeploy.apis.onnxruntime as ort_apis
|
||||
logging.info(f'onnxruntime: {ort_version} ops_is_avaliable : '
|
||||
f'{ort_apis.is_available()}')
|
||||
|
||||
try:
|
||||
import tensorrt as trt
|
||||
except ImportError:
|
||||
trt_version = None
|
||||
else:
|
||||
trt_version = trt.__version__
|
||||
import mmdeploy.apis.tensorrt as trt_apis
|
||||
logging.info(
|
||||
f'tensorrt: {trt_version} ops_is_avaliable : {trt_apis.is_available()}'
|
||||
)
|
||||
|
||||
try:
|
||||
import ncnn
|
||||
except ImportError:
|
||||
ncnn_version = None
|
||||
else:
|
||||
ncnn_version = ncnn.__version__
|
||||
import mmdeploy.apis.ncnn as ncnn_apis
|
||||
logging.info(
|
||||
f'ncnn: {ncnn_version} ops_is_avaliable : {ncnn_apis.is_available()}')
|
||||
|
||||
import mmdeploy.apis.ppl as ppl_apis
|
||||
logging.info(f'ppl_is_avaliable: {ppl_apis.is_available()}')
|
||||
|
||||
import mmdeploy.apis.openvino as openvino_apis
|
||||
logging.info(f'openvino_is_avaliable: {openvino_apis.is_available()}')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
for name, val in collect_env().items():
|
||||
logging.info('{}: {}'.format(name, val))
|
||||
check_backend()
|
Loading…
Reference in New Issue