rahul7star commited on
Commit
036ffff
·
verified ·
1 Parent(s): 909217d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -7,6 +7,17 @@ import gradio as gr
7
  import os
8
  os.environ["CUDA_VISIBLE_DEVICES"] = ""
9
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
 
12
 
 
7
  import os
8
  os.environ["CUDA_VISIBLE_DEVICES"] = ""
9
 
10
+ import torch
11
+
12
+ # 🔥 GLOBAL PATCH: force all torch.load to CPU
13
+ _original_torch_load = torch.load
14
+
15
+ def _cpu_only_torch_load(*args, **kwargs):
16
+ kwargs.setdefault("map_location", torch.device("cpu"))
17
+ return _original_torch_load(*args, **kwargs)
18
+
19
+ torch.load = _cpu_only_torch_load
20
+
21
 
22
 
23