aim-uofa / AdelaiDet

AdelaiDet is an open source toolbox for multiple instance-level detection and recognition tasks.
https://git.io/AdelaiDet
Other
3.39k stars 652 forks source link

_train_loader_from_config() takes 1 positional argument but 2 were given #235

Closed wincle closed 4 years ago

wincle commented 4 years ago

Traceback (most recent call last): File "tools/train_net.py", line 237, in launch( File "/root/anaconda3/lib/python3.8/site-packages/detectron2/engine/launch.py", line 62, in launch main_func(args) File "tools/train_net.py", line 225, in main trainer = Trainer(cfg) File "tools/train_net.py", line 62, in init data_loader = self.build_train_loader(cfg) File "tools/train_net.py", line 128, in build_train_loader return build_detection_train_loader(cfg, mapper) File "/root/anaconda3/lib/python3.8/site-packages/detectron2/config/config.py", line 201, in wrapped explicit_args = _get_args_from_config(from_config, args, *kwargs) File "/root/anaconda3/lib/python3.8/site-packages/detectron2/config/config.py", line 236, in _get_args_from_config ret = from_config_func(args, **kwargs) TypeError: _train_loader_from_config() takes 1 positional argument but 2 were given

When I first run the code, it comes up, How could I fix it? Thx.

arjunbhargava commented 4 years ago

Recently changed commit from detectron2: https://github.com/facebookresearch/detectron2/commit/01b933e7cba7c2b089b1441cc75782111aa96d1f#diff-d5792ff78c71a36dc9d44274a4118f6af14085336aa53bf9f3e52bb4ff0eff65

If you change the signature to build_detection_train_loader(cfg, mapper=mapper) it should work.

syusukee commented 4 years ago

I meet the same problem when I want to train among different machines.But when I only train on a single machine, it works normally. A little bit strange

syusukee commented 4 years ago

Do you mean it's a problem caused by the edition of Detectron2? I'm new to this,can you explain the solution more detailed? Thanks a lot!! @arjunbhargava

wincle commented 4 years ago

Recently changed commit from detectron2: facebookresearch/detectron2@01b933e#diff-d5792ff78c71a36dc9d44274a4118f6af14085336aa53bf9f3e52bb4ff0eff65

If you change the signature to build_detection_train_loader(cfg, mapper=mapper) it should work.

Thx a lot! it worked.

wincle commented 4 years ago

Recently changed commit from detectron2: facebookresearch/detectron2@01b933e#diff-d5792ff78c71a36dc9d44274a4118f6af14085336aa53bf9f3e52bb4ff0eff65

If you change the signature to build_detection_train_loader(cfg, mapper=mapper) it should work.

Thx for your help, it worked, but I met another problem.

Traceback (most recent call last): File "tools/train_net.py", line 237, in launch( File "/root/anaconda3/lib/python3.8/site-packages/detectron2/engine/launch.py", line 62, in launch main_func(*args) File "tools/train_net.py", line 225, in main trainer = Trainer(cfg) File "tools/train_net.py", line 69, in init super(DefaultTrainer, self).init(model, data_loader, optimizer) TypeError: init() takes 1 positional argument but 4 were given

I thought may be another version issue, how could I fix it?

ppwwyyxx commented 4 years ago

_train_loader_from_config() takes 1 positional argument but 2 were given

should be fixed by https://github.com/facebookresearch/detectron2/commit/957d05be51b1086e7c917bd8b6adcf1d253fa432

super(DefaultTrainer, self).init(model, data_loader, optimizer) TypeError: init() takes 1 positional argument but 4 were given

tools/train_net.py tries to super() its grandparent class: https://github.com/aim-uofa/AdelaiDet/blob/5cd38f24c2927975df103ee0dede3081a3d4f239/tools/train_net.py#L69 . this stops working when the class hierarchy changes. To resolve this you can rewrite __init__ following DefaultTrainer.__init__. The most stable way is to not depend on DefaultTrainer since DefaultTrainer is not as stable as others

Drangonliao123 commented 4 years ago

@wincle Hello! I encountered the same problem as you. Have you solved it? Could you please tell me exactly how to solve it?

tianzhi0549 commented 4 years ago

@Drangonliao123 If you have any problems related to detectron2, please try to use the detectron2 with commit id 9eb4831, which is tested by us.

Drangonliao123 commented 4 years ago

@Drangonliao123 If you have any problems related to detectron2, please try to use the detectron2 with commit id 9eb4831, which is tested by us.

thanks a lot ! I tried to uninstall the update and installed the latest detectron2 (facebookresearch/detectron2), but another error occurred:

Traceback (most recent call last): File "/home/z/anaconda3/envs/abcnet/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 20, in _wrap fn(i, args) File "/home/z/liao/AdelaiDet-master/detectron2/detectron2/engine/launch.py", line 94, in _distributed_worker main_func(args) File "/home/z/liao/AdelaiDet-master/tools/train_net.py", line 226, in main trainer = Trainer(cfg) File "/home/z/liao/AdelaiDet-master/tools/train_net.py", line 70, in init super().init(model, data_loader, optimizer) TypeError: init() takes 2 positional arguments but 4 were given

How can i fix it?

Drangonliao123 commented 4 years ago

File "/home/z/anaconda3/lib/python3.8/site-packages/torch/multiprocessing/spawn.py", line 20, in _wrap fn(i, args) File "/home/z/liao/AdelaiDet/detectron2/detectron2/engine/launch.py", line 94, in _distributed_worker main_func(args) File "/home/z/liao/AdelaiDet/tools/train_net.py", line 225, in main trainer = Trainer(cfg) File "/home/z/liao/AdelaiDet/tools/train_net.py", line 69, in init super(DefaultTrainer, self).init(model, data_loader, optimizer) TypeError: init() takes 1 positional argument but 4 were given

The problem is still not solved after modification with id 9eb4831? What is the problem? @ppwwyyxx

wincle commented 4 years ago

File "/home/z/anaconda3/lib/python3.8/site-packages/torch/multiprocessing/spawn.py", line 20, in _wrap fn(i, args) File "/home/z/liao/AdelaiDet/detectron2/detectron2/engine/launch.py", line 94, in _distributed_worker main_func(args) File "/home/z/liao/AdelaiDet/tools/train_net.py", line 225, in main trainer = Trainer(cfg) File "/home/z/liao/AdelaiDet/tools/train_net.py", line 69, in init super(DefaultTrainer, self).init(model, data_loader, optimizer) TypeError: init() takes 1 positional argument but 4 were given

The problem is still not solved after modification with id 9eb4831? What is the problem? @ppwwyyxx

use the detectron2 with commit id 9eb4831 fix my problem, maybe you didn't fully uninstall your detectron2 before compile? try it again.

zhenghan408 commented 3 years ago

@Drangonliao123 If you have any problems related to detectron2, please try to use the detectron2 with commit id 9eb4831, which is tested by us.

i want to know what is the mean of the red and green in facebookresearch/detectron2@9eb4831 ,,,,,,thanks o lot

zhenghan408 commented 3 years ago

File "/home/z/anaconda3/lib/python3.8/site-packages/torch/multiprocessing/spawn.py", line 20, in _wrap fn(i, args) File "/home/z/liao/AdelaiDet/detectron2/detectron2/engine/launch.py", line 94, in _distributed_worker main_func(args) File "/home/z/liao/AdelaiDet/tools/train_net.py", line 225, in main trainer = Trainer(cfg) File "/home/z/liao/AdelaiDet/tools/train_net.py", line 69, in init super(DefaultTrainer, self).init(model, data_loader, optimizer) TypeError: init() takes 1 positional argument but 4 were given The problem is still not solved after modification with id 9eb4831? What is the problem? @ppwwyyxx

use the detectron2 with commit id 9eb4831 fix my problem, maybe you didn't fully uninstall your detectron2 before compile? try it again.

i want to know what is the mean of the red and green in facebookresearch/detectron2@9eb4831 ,,,,,,thanks o lot