ArtGAN / load_model.py
Haimi's picture
Create load_model.py
8d4c3ed
raw
history blame contribute delete
No virus
505 Bytes
import torch
import os
# Define the model architecture and other necessary functions/classes
# ... (This would include the 'Pix2PixModelAdjusted', 'Opt', and any other necessary classes)
# Initialize the model
opt = Opt()
model = Pix2PixModelAdjusted(opt)
model.netG.eval() # Set to evaluation mode
# Load the trained weights
model_path = "./latest_net_G.pth" # Adjust the path if necessary
model.netG.load_state_dict(torch.load(model_path))
# The model is now initialized and ready for inferencing