Spaces:
Sleeping
Sleeping
map location model to cpu
Browse files- test_few_shot.py +1 -1
test_few_shot.py
CHANGED
|
@@ -31,7 +31,7 @@ def test_main_model(opts):
|
|
| 31 |
st.write("Loading Model Weight...")
|
| 32 |
model_main = ModelMain(opts)
|
| 33 |
path_ckpt = os.path.join(f"{opts.model_path}")
|
| 34 |
-
model_main.load_state_dict(torch.load(path_ckpt
|
| 35 |
model_main.to(device)
|
| 36 |
model_main.eval()
|
| 37 |
with torch.no_grad():
|
|
|
|
| 31 |
st.write("Loading Model Weight...")
|
| 32 |
model_main = ModelMain(opts)
|
| 33 |
path_ckpt = os.path.join(f"{opts.model_path}")
|
| 34 |
+
model_main.load_state_dict(torch.load(path_ckpt, map_location=torch.device('cpu'))['model'])
|
| 35 |
model_main.to(device)
|
| 36 |
model_main.eval()
|
| 37 |
with torch.no_grad():
|