Can't run how-to-finetune-rf-detr-on-segmentation-dataset notebook. RuntimeError: selected index k out of range

Open
#426 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
jupyter-notebook, python, pytorch

Research direction

Reproduce the failure in the how-to-finetune-rf-detr-on-segmentation-dataset notebook using the supplied Colab example and rfdetr 1.4.3. Start at the model.train call and the lwdetr.py traceback around line 753; done means the first epoch completes without the selected-index error and the notebook remains runnable in the reported environment.

Written by the indexing model from the issue text.

Description

bug
Search before asking
  • I have searched the Roboflow Notebooks issues and found no similar bug report.
Notebook name

how-to-finetune-rf-detr-on-segmentation-dataset

Bug

When trying to execute notebook code I get an error at the end of the first epoch. No changes were made to the notebook. I'm using rfdetr 1.4.3

RuntimeError Traceback (most recent call last)
/tmp/ipython-input-515328503.py in <cell line: 0>()
3 model = RFDETRSegNano()
4
----> 5 model.train(dataset_dir=dataset.location, epochs=5, batch_size=4, grad_accum_steps=4)

7 frames
/usr/local/lib/python3.12/dist-packages/rfdetr/models/lwdetr.py in forward(self, outputs, target_sizes)
751
752 prob = out_logits.sigmoid()
--> 753 topk_values, topk_indexes = torch.topk(prob.view(out_logits.shape[0], -1), self.num_select, dim=1)
754 scores = topk_values
755 topk_boxes = topk_indexes // out_logits.shape[2]

RuntimeError: selected index k out of range

Image
Environment
  • Google colab
  • T4 GPU
  • CUDA 13.0
Minimal Reproducible Example

from roboflow import download_dataset

dataset = download_dataset("https://universe.roboflow.com/roboflow-jvuqo/creacks-eapny/4", "coco")

from rfdetr import RFDETRSegNano

model = RFDETRSegNano()

model.train(dataset_dir=dataset.location, epochs=5, batch_size=4, grad_accum_steps=4)

Additional

No response

Are you willing to submit a PR?
  • Yes I'd like to help by submitting a PR!
Dominant language
Jupyter Notebook
Stars
9.7k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from roboflow/notebooks

All issues in roboflow/notebooks

Similar issues

More Computer Vision issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.