Skip to content

Conversation

surya3214
Copy link

@surya3214 surya3214 commented Jun 23, 2025

Description

Training with coco_dir option fails due to a small bug from L#52

NameError: name 'device_supports_cuda' is not defined

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How has this change been tested, please provide a testcase or example of how you tested the change?

"python3 cli/main.py --coco_dir " won't fail anymore due to "NameError" from "device_supports_cuda"

Any specific deployment considerations

None

Docs

None

@CLAassistant
Copy link

CLAassistant commented Jun 23, 2025

CLA assistant check
All committers have signed the CLA.

@surya3214
Copy link
Author

@yeldarby @probicheaux I'd appreciate if you could please check this

@nok
Copy link

nok commented Jun 23, 2025

Hello @surya3214 , alternatively you can use the variable DEVICE from the config.py#L11:

def train_from_coco_dir(coco_dir: str):
    from rfdetr.config import DEVICE

    rf_detr = RFDETRBase()
    rf_detr.train(
        dataset_dir=coco_dir,
        epochs=1,
        device=DEVICE,
    )

@surya3214
Copy link
Author

surya3214 commented Jun 24, 2025

from rfdetr.config import DEVICE

Thanks @nok I've updated it. I see device_supports_cuda() is used in train_from_rf_project() as well. Should that be updated too?

@Abdul-Mukit
Copy link

Why should it not be defined by the user?
e.g. In most CLI commands for DETRs we can usually set it by --device option.

parser.add_argument('--device', default='cuda',
                        help='device to use for training / testing')

@surya3214
Copy link
Author

Why should it not be defined by the user? e.g. In most CLI commands for DETRs we can usually set it by --device option.

parser.add_argument('--device', default='cuda',
                        help='device to use for training / testing')

This PR only keeps the status quo wrt device selection and avoids build error.

While that suggestion is really useful, I shall consider it in a different PR. WDYT?

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

Successfully merging this pull request may close these issues.

4 participants