Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add rknn device check #1363

Merged
merged 6 commits into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions mmdeploy/backend/rknn/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Copyright (c) OpenMMLab. All rights reserved.
import importlib
import re
import subprocess


def is_available():
Expand All @@ -13,17 +11,6 @@ def is_available():
return importlib.util.find_spec('rknn') is not None


def device_available():
"""Check whether device available.

Returns:
bool: True if the device is available.
"""
ret = subprocess.check_output('adb devices', shell=True)
match = re.search(r'\\n\w+\\tdevice', str(ret))
return match is not None


__all__ = []

if is_available():
Expand Down
5 changes: 0 additions & 5 deletions mmdeploy/utils/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@ def check_backend(backend: Backend, require_plugin: bool = False):
from mmdeploy.backend.torchscript import ops_available as is_available
elif backend == Backend.RKNN:
from mmdeploy.backend.rknn import is_available
if not is_available():
# skip CI in github
pytest.skip(f'{backend.value} package is not available')
# device required
from mmdeploy.backend.rknn import device_available as is_available
elif backend == Backend.ASCEND:
from mmdeploy.backend.ascend import is_available
else:
Expand Down
3 changes: 3 additions & 0 deletions tools/check_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ def check_backend():
import mmdeploy.apis.coreml as coreml_apis
logger.info(f'coreml_is_available: {coreml_apis.is_available()}')

import mmdeploy.apis.rknn as rknn_apis
logger.info(f'rknn_is_avaliable: {rknn_apis.is_available()}')


def check_codebase():
codebase_versions = get_codebase_version()
Expand Down