Spaces:
Running
on
Zero
Running
on
Zero
detach after copy_
Browse files
app.py
CHANGED
@@ -45,8 +45,8 @@ def compile_model():
|
|
45 |
weights_: dict[str, torch.Tensor] = {}
|
46 |
for name in weights:
|
47 |
tensor, _properties = weights.get_weight(name)
|
48 |
-
tensor_ = torch.empty_like(tensor, device='cpu'
|
49 |
-
weights_[name] = tensor_.copy_(tensor).share_memory_()
|
50 |
return weights_
|
51 |
|
52 |
weights = compile_model()
|
|
|
45 |
weights_: dict[str, torch.Tensor] = {}
|
46 |
for name in weights:
|
47 |
tensor, _properties = weights.get_weight(name)
|
48 |
+
tensor_ = torch.empty_like(tensor, device='cpu').pin_memory()
|
49 |
+
weights_[name] = tensor_.copy_(tensor).detach().share_memory_()
|
50 |
return weights_
|
51 |
|
52 |
weights = compile_model()
|