cbensimon HF Staff commited on
Commit
9292d1e
·
1 Parent(s): f1f06d3

detach after copy_

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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', requires_grad=False).pin_memory()
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()