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

About the eval_model in EpochBasedRunner_video when train the tiny_fp16 #255

Open
1170300714 opened this issue May 7, 2024 · 0 comments

Comments

@1170300714
Copy link

1170300714 commented May 7, 2024

Thanks for your great job

When I train the model with tiny_fp16, I find the followings bug:

Traceback (most recent call last):
File "./tools/train.py", line 263, in
main()
File "./tools/train.py", line 252, in main
custom_train_model(
File "/data/projects/BEVFormer-master/projects/mmdet3d_plugin/bevformer/apis/train.py", line 27, in custom_train_model
custom_train_detector(
File "/data/projects/BEVFormer-master/projects/mmdet3d_plugin/bevformer/apis/mmdet_train.py", line 125, in custom_train_detector
runner = build_runner(
File "/data/projects/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/mmcv/runner/builder.py", line 23, in build_runner
runner = runner_constructor()
File "/data/projects/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/mmcv/runner/default_constructor.py", line 44, in call
return RUNNERS.build(self.runner_cfg, default_args=self.default_args)
File "/data/projects/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/mmcv/utils/registry.py", line 212, in build
return self.build_func(*args, **kwargs, registry=self)
File "/data/projects/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/mmcv/utils/registry.py", line 55, in build_from_cfg
raise type(e)(f'{obj_cls.name}: {e}')
AttributeError: EpochBasedRunner_video: 'NoneType' object has no attribute 'eval'
Traceback (most recent call last):
File "/data/projects/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/mmcv/utils/registry.py", line 52, in build_from_cfg
return obj_cls(**args)
File "/data/projects/BEVFormer-master/projects/mmdet3d_plugin/bevformer/runner/epoch_based_runner.py", line 55, in init
self.eval_model.eval()
AttributeError: 'NoneType' object has no attribute 'eval'

This is cause by the init function of class EpochBasedRunner_video, because the para: eval_model is None.

`@RUNNERS.register_module()
class EpochBasedRunner_video(EpochBasedRunner):
'''
# basic logic

input_sequence = [a, b, c] # given a sequence of samples

prev_bev = None
for each in input_sequcene[:-1]
    prev_bev = eval_model(each, prev_bev)) # inference only.

model(input_sequcene[-1], prev_bev) # train the last sample.
'''

def __init__(self,
             model,
             eval_model=None,
             batch_processor=None,
             optimizer=None,
             work_dir=None,
             logger=None,
             meta=None,
             keys=['gt_bboxes_3d', 'gt_labels_3d', 'img'],
             max_iters=None,
             max_epochs=None):
    super().__init__(model,
             batch_processor,
             optimizer,
             work_dir,
             logger,
             meta,
             max_iters,
             max_epochs)
    keys.append('img_metas')
    self.keys = keys
    self.eval_model = eval_model
    self.eval_model.eval()`

May I ask how to solve this problem? In fact, I simply modified the runner from "EpochBasedRunner_video" to "EpochBasedRunner" which the other configs (tiny, base, small), but it will appear new bug when inference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant