Skip to content

Commit 23003a3

Browse files
authored
fix: AttributeError when device_id is not None (#86)
* fix: AttributeError when device_id is not None init logger.info(f"Using device: {self._device}") AttributeError when device_id is not None * fix: tensors to be on the same device, but found at least two devices when using cuda Fix RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument index in method wrapper_CUDA__index_select) when using CUDA. * fix: lint
1 parent 2331fa3 commit 23003a3

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

boson_multimodal/audio_processing/higgs_audio_tokenizer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ def _xcodec_encode(self, x: torch.Tensor, target_bw: Optional[int] = None) -> to
294294
return EncodedResult(codes)
295295

296296
def decode(self, vq_code: torch.Tensor) -> torch.Tensor:
297+
vq_code = vq_code.to(self.device)
298+
297299
if self.quantizer_type == "RVQ":
298300
vq_code = vq_code.permute(1, 0, 2)
299301
quantized = self.quantizer.decode(vq_code)

examples/generation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ def __init__(
189189
# Use explicit device if provided, otherwise try CUDA/MPS/CPU
190190
if device_id is not None:
191191
device = f"cuda:{device_id}"
192+
self._device = device
192193
else:
193194
if device is not None:
194195
self._device = device

0 commit comments

Comments
 (0)