Daankular commited on
Commit
fc017ad
·
verified ·
1 Parent(s): 6ce5fd0

Reset torch default device to cpu after offload.profile(): mmgp leaves it as cuda, which broke SMPLDataset tensor creation later in the script

Browse files
Files changed (1) hide show
  1. inference.py +4 -0
inference.py CHANGED
@@ -188,6 +188,10 @@ def load_pshuman_pipeline(cfg):
188
  # main model, instead of keeping the whole pipeline resident in VRAM at once.
189
  from mmgp import offload, profile_type
190
  offload.profile(pipeline, profile_type.LowRAM_LowVRAM, verboseLevel=1)
 
 
 
 
191
  return pipeline
192
 
193
  def main(
 
188
  # main model, instead of keeping the whole pipeline resident in VRAM at once.
189
  from mmgp import offload, profile_type
190
  offload.profile(pipeline, profile_type.LowRAM_LowVRAM, verboseLevel=1)
191
+ # offload.profile() deliberately leaves torch's global default device set to
192
+ # 'cuda' afterward; reset it so unrelated later code (e.g. SMPLDataset, which
193
+ # expects CPU-by-default tensor creation) isn't silently affected.
194
+ torch.set_default_device('cpu')
195
  return pipeline
196
 
197
  def main(