BoxOfColors commited on
Commit
35c95b4
·
1 Parent(s): 21ece0c

Fix HunyuanFoley xregen AttributeError: return torch.device from _get_device_and_dtype

Browse files

denoise_process calls torch.autocast(device_type=device.type, ...) which
requires a torch.device object. _get_device_and_dtype was returning a plain
string 'cuda', causing AttributeError: 'str' object has no attribute 'type'.
All other usages (.to(), map_location=, device=) work with torch.device too.

Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -175,8 +175,9 @@ def _ensure_syspath(subdir: str) -> str:
175
 
176
 
177
  def _get_device_and_dtype() -> tuple:
178
- """Return (device, weight_dtype) pair used by all GPU functions."""
179
- device = "cuda" if torch.cuda.is_available() else "cpu"
 
180
  return device, torch.bfloat16
181
 
182
 
 
175
 
176
 
177
  def _get_device_and_dtype() -> tuple:
178
+ """Return (device, weight_dtype) pair used by all GPU functions.
179
+ Returns a torch.device object so callers can use device.type safely."""
180
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
181
  return device, torch.bfloat16
182
 
183