Haimi commited on
Commit
8d4c3ed
1 Parent(s): cae80cc

Create load_model.py

Browse files
Files changed (1) hide show
  1. load_model.py +16 -0
load_model.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import os
3
+
4
+ # Define the model architecture and other necessary functions/classes
5
+ # ... (This would include the 'Pix2PixModelAdjusted', 'Opt', and any other necessary classes)
6
+
7
+ # Initialize the model
8
+ opt = Opt()
9
+ model = Pix2PixModelAdjusted(opt)
10
+ model.netG.eval() # Set to evaluation mode
11
+
12
+ # Load the trained weights
13
+ model_path = "./latest_net_G.pth" # Adjust the path if necessary
14
+ model.netG.load_state_dict(torch.load(model_path))
15
+
16
+ # The model is now initialized and ready for inferencing