Spaces:
Configuration error
Configuration error
Kangarroar
commited on
Commit
•
0453296
1
Parent(s):
fb08baa
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,18 @@ from infer import *
|
|
10 |
import logging
|
11 |
from infer_tools.infer_tool import *
|
12 |
map_location=torch.device('cpu')
|
|
|
|
|
|
|
|
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
logging.getLogger('numba').setLevel(logging.WARNING)
|
15 |
|
16 |
# 工程文件夹名,训练时用的那个
|
|
|
10 |
import logging
|
11 |
from infer_tools.infer_tool import *
|
12 |
map_location=torch.device('cpu')
|
13 |
+
##EDIT FOR CPU
|
14 |
+
# Open the file and read it into a string
|
15 |
+
with open("/home/user/.local/lib/python3.8/site-packages/torch/serialization.py") as f:
|
16 |
+
text = f.read()
|
17 |
|
18 |
+
# Replace the original line with the new line
|
19 |
+
text = text.replace("map_location: MAP_LOCATION = None,", "map_location: MAP_LOCATION = 'CPU',")
|
20 |
+
|
21 |
+
# Save the modified string to the original file
|
22 |
+
with open("/home/user/.local/lib/python3.8/site-packages/torch/serialization.py", "w") as f:
|
23 |
+
f.write(text)
|
24 |
+
############
|
25 |
logging.getLogger('numba').setLevel(logging.WARNING)
|
26 |
|
27 |
# 工程文件夹名,训练时用的那个
|