tri86uit commited on
Commit
c7f5ebd
·
verified ·
1 Parent(s): 582fe05

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -69,7 +69,10 @@ for key,value in finetuned_path.items():
69
  if 'transformer.base_model.model.' in key:
70
  transformer_dict[key.replace('transformer.base_model.model.', '')] = value
71
  pipeline.transformer.load_state_dict(transformer_dict, strict=False)
72
- pipeline.to('cuda')
 
 
 
73
  pipeline.enable_vae_slicing()
74
  pipeline.enable_vae_tiling()
75
 
 
69
  if 'transformer.base_model.model.' in key:
70
  transformer_dict[key.replace('transformer.base_model.model.', '')] = value
71
  pipeline.transformer.load_state_dict(transformer_dict, strict=False)
72
+ #pipeline.to('cuda')
73
+ # Tự động kiểm tra: Có GPU thì dùng, không có thì dùng CPU
74
+ device = "cuda" if torch.cuda.is_available() else "cpu"
75
+ pipeline.to(device)
76
  pipeline.enable_vae_slicing()
77
  pipeline.enable_vae_tiling()
78