Spaces:
Runtime error
Runtime error
ZeroGPUWeights debug
Browse files- optimization_utils.py +2 -0
optimization_utils.py
CHANGED
|
@@ -27,6 +27,7 @@ class ZeroGPUWeights:
|
|
| 27 |
else:
|
| 28 |
self.constants_map = constants_map
|
| 29 |
def __reduce__(self):
|
|
|
|
| 30 |
constants_map: dict[str, torch.Tensor] = {}
|
| 31 |
for name, tensor in self.constants_map.items():
|
| 32 |
tensor_ = torch.empty_like(tensor, device='cpu').pin_memory()
|
|
@@ -46,6 +47,7 @@ class ZeroGPUCompiledModel:
|
|
| 46 |
self.compiled_model.set(compiled_model)
|
| 47 |
return compiled_model(*args, **kwargs)
|
| 48 |
def __reduce__(self):
|
|
|
|
| 49 |
return ZeroGPUCompiledModel, (self.archive_file, self.weights)
|
| 50 |
|
| 51 |
|
|
|
|
| 27 |
else:
|
| 28 |
self.constants_map = constants_map
|
| 29 |
def __reduce__(self):
|
| 30 |
+
print('ZeroGPUWeights.__reduce__', f'{id(self)=}', sum([tensor.nbytes for tensor in self.constants_map.values()]))
|
| 31 |
constants_map: dict[str, torch.Tensor] = {}
|
| 32 |
for name, tensor in self.constants_map.items():
|
| 33 |
tensor_ = torch.empty_like(tensor, device='cpu').pin_memory()
|
|
|
|
| 47 |
self.compiled_model.set(compiled_model)
|
| 48 |
return compiled_model(*args, **kwargs)
|
| 49 |
def __reduce__(self):
|
| 50 |
+
print('ZeroGPUCompiledModel.__reduce__', f'{id(self.weights)=}')
|
| 51 |
return ZeroGPUCompiledModel, (self.archive_file, self.weights)
|
| 52 |
|
| 53 |
|