`torch.device`: The device on which the module is (assuming that all the module parameters are on the same device).
(self)
| 1281 | |
| 1282 | @property |
| 1283 | def device(self) -> torch.device: |
| 1284 | """ |
| 1285 | `torch.device`: The device on which the module is (assuming that all the module parameters are on the same |
| 1286 | device). |
| 1287 | """ |
| 1288 | # for bark_model, device must be verified on its sub-models |
| 1289 | # if has _hf_hook, has been offloaded so the device has to be found in the hook |
| 1290 | if not hasattr(self.semantic, "_hf_hook"): |
| 1291 | return super().device |
| 1292 | for module in self.semantic.modules(): |
| 1293 | if ( |
| 1294 | hasattr(module, "_hf_hook") |
| 1295 | and hasattr(module._hf_hook, "execution_device") |
| 1296 | and module._hf_hook.execution_device is not None |
| 1297 | ): |
| 1298 | return torch.device(module._hf_hook.execution_device) |
| 1299 | |
| 1300 | def enable_cpu_offload( |
| 1301 | self, |
no outgoing calls
no test coverage detected