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
yaoyuping
nnDetection
Commits
dd9030cc
Commit
dd9030cc
authored
Apr 26, 2021
by
mibaumgartner
Browse files
dynamic import to register modules (not the final solution)
parent
c8e188f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
nndet/utils/config.py
nndet/utils/config.py
+7
-1
No files found.
nndet/utils/config.py
View file @
dd9030cc
...
...
@@ -15,9 +15,11 @@ limitations under the License.
"""
import
json
import
importlib
from
pathlib
import
Path
import
yaml
from
omegaconf
import
OmegaConf
from
hydra.experimental
import
compose
as
hydra_compose
from
nndet.io.paths
import
Pathlike
,
get_task
...
...
@@ -51,10 +53,14 @@ def load_dataset_info(task_dir: Pathlike) -> dict:
def
compose
(
task
,
*
args
,
models
:
bool
=
False
,
**
kwargs
)
->
dict
:
from
omegaconf
import
OmegaConf
cfg
=
hydra_compose
(
*
args
,
**
kwargs
)
OmegaConf
.
set_struct
(
cfg
,
False
)
task_name
=
get_task
(
task
,
name
=
True
,
models
=
models
)
cfg
[
"task"
]
=
task_name
cfg
[
"data"
]
=
load_dataset_info
(
get_task
(
task_name
))
for
imp
in
cfg
.
get
(
"additional_imports"
,
[]):
print
(
f
"Additional import found
{
imp
}
"
)
importlib
.
import_module
(
imp
)
return
cfg
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