fix: remove hardcoded CUDA assumptions in ERFNet to support CPU-only execution#554
fix: remove hardcoded CUDA assumptions in ERFNet to support CPU-only execution#554Fahmid-Arman wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Fahmid-Arman The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Code Review
This pull request dynamically configures CUDA usage based on GPU availability instead of hardcoding it. Key changes include conditional checkpoint loading and tensor GPU transfer in train.py, and initializing CUDA flags dynamically using torch.cuda.is_available() in utils/args.py. The review feedback suggests improving this by using the configured args.gpu_ids instead of hardcoding 'cuda:0' when loading checkpoints, and allowing cuda and no_cuda parameters to be overridden via kwargs in both TrainArgs and ValArgs to prevent conflicting states and support explicit CPU execution.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
…execution Signed-off-by: Fahmid Arman <fahmid.brac@gmail.com>
ba1d607 to
4596a15
Compare
|
Feedback addressed:
/assign @jaypume |
What type of PR is this?
/kind bug
What this PR does / why we need it:
The ERFNet training and evaluation utilities contained hardcoded CUDA availability assumptions, causing the pipeline to crash immediately on CPU-only machines and Apple Silicon devices.
self.cuda = torch.cuda.is_available()(andself.no_cuda) withinTrainArgsandValArgsinutils/args.py.train.pyto use a dynamicmap_locationsupporting CPU fallback.if self.args.cuda:guard around atarget.cuda()call within thetraining()loop intrain.pyto match the surrounding tensor handling logic.This unblocks ERFNet execution for contributors running the benchmark on non-NVIDIA hardware.
Which issue(s) this PR fixes:
Fixes #471