-
Notifications
You must be signed in to change notification settings - Fork 6
Description
When running the Test script using the uplaoded weights(provided in this issue), the model's forward method receives the same parameter (return_loss) twice, which causes Python to raise an error.
Error Details
In /adzoo/vad/apis/test.py, both test functions are calling the model with incorrect parameter passing:
- In single_gpu_test() function (line ~183):
result = model(data, return_loss=False, rescale=True) - In custom_multi_gpu_test() function (line ~65):
result = model(data, return_loss=False, rescale=True)
The model's forward method in /mmcv/models/detectors/VADv2.py has this signature:
def forward(self, return_loss=True, rescale=False, **kwargs):
When calling model(data, return_loss=False, rescale=True), the data is implicitly treated as the return_loss positional parameter, and then return_loss=False is explicitly passed again, resulting in the same parameter being passed twice.
Temporary Fix
I've temporarily resolved this issue by changing the calling pattern to:
result = model(return_loss=False, rescale=True, **data)
This ensures return_loss and rescale are passed as named parameters, while the contents of data are properly unpacked as additional keyword arguments.
Concerns
I noticed that /adzoo/bevformer/apis/test.py appears to use the same problematic calling pattern:
result = model(data, return_loss=False, rescale=True)
This might cause similar errors depending on how the BEVFormer model's forward method is defined.
Questions for Authors
-
Is the fix I've implemented (changing to model(return_loss=False, rescale=True, **data)) the correct approach? Or there is other solutions.
-
Should similar changes be made to the BEVFormer test module and any other modules with similar calling patterns?
Any guidance on the preferred code style and parameter passing conventions for the project would be greatly appreciated.