Skip to content

Commit 10e97e4

Browse files
ppwwyyxxfacebook-github-bot
authored andcommitted
cfg update
Summary: Pull Request resolved: fairinternal/detectron2#516 Reviewed By: alexander-kirillov Differential Revision: D27017312 Pulled By: ppwwyyxx fbshipit-source-id: 36995a9a5ccf3c98283e44db6ba34094b26c9f2c
1 parent 321735b commit 10e97e4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

detectron2/config/instantiate.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ def instantiate(cfg):
4545
"""
4646
from omegaconf import ListConfig
4747

48-
if isinstance(cfg, (list, tuple, ListConfig)):
48+
if isinstance(cfg, ListConfig):
49+
lst = [instantiate(x) for x in cfg]
50+
return ListConfig(lst, flags={"allow_objects": True})
51+
if isinstance(cfg, list):
4952
# Specialize for list, because many classes take
5053
# list[objects] as arguments, such as ResNet, DatasetMapper
5154
return [instantiate(x) for x in cfg]

0 commit comments

Comments
 (0)