rf-detr
rf-detr copied to clipboard
[BUG][CLI] Fix error in cli script
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
- [x] 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
Any specific deployment considerations
None
Docs
None
@yeldarby @probicheaux I'd appreciate if you could please check this
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,
)
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?
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')
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?