You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-2
Original file line number
Diff line number
Diff line change
@@ -470,7 +470,21 @@ It would be ideal to train using Teacher Forcing [only some of the time](https:/
470
470
471
471
__Can I use pretrained word embeddings (GloVe, CBOW, skipgram, etc.) instead of learning them from scratch?__
472
472
473
-
Yes, you could, with the `load_pretrained_embeddings()` method in the `Decoder`. You could also choose to fine-tune (or not) with the `fine_tune_embeddings()` method.
473
+
Yes, you could, with the `load_pretrained_embeddings()` method in the `Decoder` class. You could also choose to fine-tune (or not) with the `fine_tune_embeddings()` method.
474
+
475
+
After creating the Decoder in [`train.py`](<https://github.com/sgrvinod/a-PyTorch-Tutorial-to-Image-Captioning/blob/master/eval.py), you should provide the pretrained vectors to `load_pretrained_embeddings()` stacked in the same order as in the `word_map`. For words that you don't have pretrained vectors for, like <start>, you can initialize embeddings randomly like we did in `init_weights()`. I recommend fine-tuning to learn more meaningful vectors for these randomly initialized vectors.
Also make sure to change the `embed_dim` parameter to the size of your pre-trained embeddings. This should automatically adjust the input size of the decoder LSTM to accomodate them.
474
488
475
489
---
476
490
@@ -486,4 +500,4 @@ With the release of PyTorch `0.4`, wrapping tensors as `Variable`s is no longer
486
500
487
501
__How do I compute all BLEU (i.e. BLEU-1 to BLEU-4) scores during evaluation?__
488
502
489
-
You'd need to modify the code in [eval.py](<https://github.com/sgrvinod/a-PyTorch-Tutorial-to-Image-Captioning/blob/master/eval.py#L171>) to do this. Please see [this excellent answer](<https://github.com/sgrvinod/a-PyTorch-Tutorial-to-Image-Captioning/issues/37#issuecomment-455924998>) by [kmario23](<https://github.com/kmario23>) for a clear and detailed explanation.
503
+
You'd need to modify the code in [`eval.py`](<https://github.com/sgrvinod/a-PyTorch-Tutorial-to-Image-Captioning/blob/master/eval.py) to do this. Please see [this excellent answer](<https://github.com/sgrvinod/a-PyTorch-Tutorial-to-Image-Captioning/issues/37#issuecomment-455924998>) by [kmario23](<https://github.com/kmario23>) for a clear and detailed explanation.
0 commit comments