Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
MMCV
Commits
69146fe3
Unverified
Commit
69146fe3
authored
Jun 11, 2021
by
pc
Committed by
GitHub
Jun 11, 2021
Browse files
add load_ext warning (#1089)
parent
a88d1d28
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
mmcv/utils/ext_loader.py
mmcv/utils/ext_loader.py
+9
-5
No files found.
mmcv/utils/ext_loader.py
View file @
69146fe3
import
importlib
import
importlib
import
os
import
os
import
pkgutil
import
pkgutil
import
warnings
from
collections
import
namedtuple
from
collections
import
namedtuple
import
torch
import
torch
...
@@ -14,6 +15,7 @@ if torch.__version__ != 'parrots':
...
@@ -14,6 +15,7 @@ if torch.__version__ != 'parrots':
return
ext
return
ext
else
:
else
:
from
parrots
import
extension
from
parrots
import
extension
from
parrots.base
import
ParrotsException
has_return_value_ops
=
[
has_return_value_ops
=
[
'nms'
,
'nms'
,
...
@@ -33,11 +35,11 @@ else:
...
@@ -33,11 +35,11 @@ else:
'ms_deform_attn_forward'
,
'ms_deform_attn_forward'
,
]
]
def
get_fake_func
(
name
):
def
get_fake_func
(
name
,
e
):
def
fake_func
(
*
args
,
**
kwargs
):
def
fake_func
(
*
args
,
**
kwargs
):
raise
RuntimeError
(
warnings
.
warn
(
f
'
{
name
}
is not supported in parrots now'
)
'{} is not supported in parrots now'
.
format
(
name
))
raise
e
return
fake_func
return
fake_func
...
@@ -48,8 +50,10 @@ else:
...
@@ -48,8 +50,10 @@ else:
for
fun
in
funcs
:
for
fun
in
funcs
:
try
:
try
:
ext_fun
=
extension
.
load
(
fun
,
name
,
lib_dir
=
lib_root
)
ext_fun
=
extension
.
load
(
fun
,
name
,
lib_dir
=
lib_root
)
except
Exception
:
except
ParrotsException
as
e
:
ext_fun
=
get_fake_func
(
fun
)
if
'No element registered'
not
in
e
.
message
:
warnings
.
warn
(
e
.
message
)
ext_fun
=
get_fake_func
(
fun
,
e
)
ext_list
.
append
(
ext_fun
)
ext_list
.
append
(
ext_fun
)
else
:
else
:
if
fun
in
has_return_value_ops
:
if
fun
in
has_return_value_ops
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment