stanfordnlp / GloVe

Software in C and data files for the popular GloVe model for distributed word representations, a.k.a. word vectors or embeddings
Apache License 2.0
6.86k stars 1.51k forks source link

Add options for loading initial squared gradients #171

Closed aphedges closed 4 years ago

aphedges commented 4 years ago

I made some code changes to fix #170.

I created two new parameters, -init-gradsq-file and -load-init-gradsq that correspond to -init-param-file and -load-init-param. Most of the code between the two sets of parameters is exactly the same.

AngledLuffa commented 4 years ago

Thanks for catching this! As you point out, the code blocks are almost identical. Would you mind refactoring this? If that's not your cup of tea, I should be able to do so myself later.

aphedges commented 4 years ago

Thanks for responding so quickly! I think I can refactor it. I'll comment here again when I'm done.

aphedges commented 4 years ago

I have refactored the code. I had to make some text more generic to work for both types of files, and I fixed two other typos. Please let me know if you have any more feedback.

AngledLuffa commented 4 years ago

Thanks! I merged this.

aphedges commented 4 years ago

Thank you very much!

AngledLuffa commented 4 years ago

I also added a test to the randomization.test.sh script which verifies that the training continues exactly as it was when it is reloaded like this.

aphedges commented 4 years ago

I'm glad to have some additional tests in place for this.