Skip to content

I encountered an error when working on the prompt_tuning project: TypeError:loss() missing 1 required positional argument: 'batch_data_samples'. #646

@JoyRiderJie

Description

@JoyRiderJie

My configuration file is derived from configs/prompt_tuning_coco/yolo_world_v2_l_vlpan_bn_2e-4_80e_8gpus_mask-refine_prompt_tuning_coco.py, however, I have modified the model loading part to set load_from='pretrained_models/l_stage1-7d280586.pth'.

The detailed error message is as follows:

Traceback (most recent call last):
  File "tools/train.py", line 120, in <module>
    main()
  File "tools/train.py", line 116, in main
    runner.train()
  File "/mnt/data3/zxj2024/workplace/YOLO-World/third_party/mmengine/mmengine/runner/runner.py", line 1777, in train
    model = self.train_loop.run()  # type: ignore
  File "/mnt/data3/zxj2024/workplace/YOLO-World/third_party/mmengine/mmengine/runner/loops.py", line 98, in run
    self.run_epoch()
  File "/mnt/data3/zxj2024/workplace/YOLO-World/third_party/mmengine/mmengine/runner/loops.py", line 115, in run_epoch
    self.run_iter(idx, data_batch)
  File "/mnt/data3/zxj2024/workplace/YOLO-World/third_party/mmengine/mmengine/runner/loops.py", line 131, in run_iter
    outputs = self.runner.model.train_step(
  File "/mnt/data3/zxj2024/workplace/YOLO-World/third_party/mmengine/mmengine/model/base_model/base_model.py", line 114, in train_step
    losses = self._run_forward(data, mode='loss')  # type: ignore
  File "/mnt/data3/zxj2024/workplace/YOLO-World/third_party/mmengine/mmengine/model/base_model/base_model.py", line 361, in _run_forward
    results = self(**data, mode=mode)
  File "/mnt/data3/zxj2024/conda_envs/yolo_world/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "/mnt/data3/zxj2024/workplace/YOLO-World/third_party/mmdetection/mmdet/models/detectors/base.py", line 92, in forward
    return self.loss(inputs, data_samples)
  File "/mnt/data3/zxj2024/workplace/YOLO-World/yolo_world/models/detectors/yolo_world.py", line 166, in loss
    losses = self.bbox_head.loss(img_feats, txt_feats,
TypeError: loss() missing 1 required positional argument: 'batch_data_samples'

The error occurs in the SimpleYOLOWorldDetector class within the file yolo_world/models/detectors/yolo_world.py, specifically spanning lines 163 to 167.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions