Create Helper_functions.py
Browse files- Helper_functions.py +10 -0
Helper_functions.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# utils/helper_functions.py
|
| 2 |
+
import torch
|
| 3 |
+
|
| 4 |
+
def save_model(model, path):
|
| 5 |
+
torch.save(model.state_dict(), path)
|
| 6 |
+
|
| 7 |
+
def load_model(model, path):
|
| 8 |
+
model.load_state_dict(torch.load(path))
|
| 9 |
+
model.eval()
|
| 10 |
+
return model
|