phonsobon commited on
Commit
c7778bb
·
verified ·
1 Parent(s): e9e0ed9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +5 -1
README.md CHANGED
@@ -124,9 +124,13 @@ decoder = AttentionDecoder(
124
  decoder_dim=config["decoder_dim"],
125
  encoder_dim=config["encoder_dim"],
126
  ).to(device)
127
- decoder.load_state_dict(torch.load(decoder_path, map_location=device))
 
128
  decoder.eval()
129
 
 
 
 
130
  # 5. Beam-search caption generation
131
  def generate_caption(image_tensor, beam_size=3, max_len=50):
132
  decoder.eval()
 
124
  decoder_dim=config["decoder_dim"],
125
  encoder_dim=config["encoder_dim"],
126
  ).to(device)
127
+ checkpoint = torch.load(decoder_path, map_location=device)
128
+ decoder.load_state_dict(checkpoint["model_state_dict"])
129
  decoder.eval()
130
 
131
+ print(f"Loaded checkpoint from epoch {checkpoint['epoch']}, "
132
+ f"best val loss: {checkpoint['best_val_loss']:.4f}")
133
+
134
  # 5. Beam-search caption generation
135
  def generate_caption(image_tensor, beam_size=3, max_len=50):
136
  decoder.eval()