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

AssertionError: record_idx is illegal. The length of data_buffer is 0, but record_idx is 0. #658

Open
achuansztu opened this issue Feb 20, 2025 · 0 comments

Comments

@achuansztu
Copy link

Checklist

  • I have searched related issues but cannot get the expected help.
  • I have read related documents and don't know what to do.

Describe the question you meet

[AssertionError: record_idx is illegal. The length of data_buffer is 0, but record_idx is 0.]

  1. Your train log file if you meet the problem during training.
    return forward_call(*input, **kwargs)
    File "/mnt/data0/Hu_jincai/mmrazor-main/mmrazor/models/algorithms/base.py", line 142, in forward
    return self.loss(inputs, data_samples)
    File "/mnt/data0/Hu_jincai/mmrazor-main/mmrazor/models/algorithms/distill/configurable/single_teacher_distill.py", line 145, in loss
    distill_losses = self.distiller.compute_distill_losses()
    File "/mnt/data0/Hu_jincai/mmrazor-main/mmrazor/models/distillers/configurable_distiller.py", line 217, in compute_distill_losses
    forward_var = self.get_record(**record)
    File "/mnt/data0/Hu_jincai/mmrazor-main/mmrazor/models/distillers/configurable_distiller.py", line 201, in get_record
    record_data = recorder_.get_record_data(record_idx, data_idx)
    File "/mnt/data0/Hu_jincai/mmrazor-main/mmrazor/models/task_modules/recorder/base_recorder.py", line 78, in get_record_data
    assert record_idx < len(self._data_buffer),
    AssertionError: record_idx is illegal. The length of data_buffer is 0, but record_idx is 0.

  2. Other code you modified in the mmrazor folder.
    [teacher_ckpt = '~/Hu_jincai/mmrazor-main/configs/distill/mmseg/KNet_best_mDice_iter_50292.pth'

noqa: E501

teacher_cfg_path = 'mmseg::knet/knet-s3_swin-l_upernet_8xb2-adamw-80k_ade20k-512x512.py' # noqa: E501

student_cfg_path = 'mmseg::fastscnn/fast_scnn_8xb4-160k_cityscapes-512x1024.py' # noqa: E501

teacher_cfg_path = 'mmseg::my_change/my_change_KNet.py' # noqa: E501
student_cfg_path = 'mmseg::my_change/my_change_FastSCNN.py' # noqa: E501

model = dict(
scope='mmrazor',
type='SingleTeacherDistill',
architecture=dict(cfg_path=student_cfg_path, pretrained=False),
teacher=dict(cfg_path=teacher_cfg_path, pretrained=False),
teacher_ckpt=teacher_ckpt,
distiller=dict(
type='ConfigurableDistiller',
distill_losses=dict(
loss_cwd=dict(type='ChannelWiseDivergence', tau=1, loss_weight=5)),
student_recorders=dict(
logits=dict(type='ModuleOutputs', source='decode_head.conv_seg')),
teacher_recorders=dict(
logits=dict(type='ModuleOutputs', source='decode_head.kernel_generate_head')),
loss_forward_mappings=dict(
loss_cwd=dict(
preds_S=dict(from_student=True, recorder='logits'),
preds_T=dict(from_student=False, recorder='logits')))))

find_unused_parameters = True

val_cfg = dict(delete=True, type='mmrazor.SingleTeacherDistillValLoop')
]

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