Skip to content

Fix SequenceRNN crash when running on CPU#20

Open
fulopjoz wants to merge 1 commit intoCDDLeiden:devfrom
fulopjoz:fix/cpu-sentinel-dataparallel
Open

Fix SequenceRNN crash when running on CPU#20
fulopjoz wants to merge 1 commit intoCDDLeiden:devfrom
fulopjoz:fix/cpu-sentinel-dataparallel

Conversation

@fulopjoz
Copy link

@fulopjoz fulopjoz commented Feb 25, 2026

Summary

SequenceRNN crashes with RuntimeError: Invalid device string: 'cuda:-1' when instantiated on a CPU-only machine.

Problem

SequenceRNN.__init__ calls self.attachToGPUs(self.gpus) after the parent constructor sets self.gpus = (-1,) for CPU. The method unconditionally builds torch.device(f'cuda:{gpus[0]}'), producing the invalid device cuda: -1.

Fix

Branch on the GPU index before creating the device. No other generators are affecte- they use the base class attachToGPUs which just calls self.to(self.device).

@martin-sicho

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.

1 participant