This repository was archived by the owner on Jan 24, 2024. It is now read-only.
add save/load dict_and_embedding for word2vector#410
Merged
jacquesqiao merged 3 commits intoPaddlePaddle:developfrom Sep 15, 2017
Merged
add save/load dict_and_embedding for word2vector#410jacquesqiao merged 3 commits intoPaddlePaddle:developfrom
jacquesqiao merged 3 commits intoPaddlePaddle:developfrom
Conversation
reyoung
reviewed
Sep 15, 2017
04.word2vec/train.py
Outdated
| f.write(key + " " + str(word_dict[key]) + "\n") | ||
| with open("embedding_table", "w") as f: | ||
| for line in embeddings: | ||
| f.write(",".join([str(x) for x in line]) + "\n") |
Collaborator
There was a problem hiding this comment.
reyoung
reviewed
Sep 15, 2017
04.word2vec/train.py
Outdated
| trainer.train( | ||
| paddle.batch(paddle.dataset.imikolov.train(word_dict, N), 32), | ||
| num_passes=100, | ||
| num_passes=1, |
reyoung
reviewed
Sep 15, 2017
| word_dict = dict() | ||
| with open("word_dict", "r") as f: | ||
| for line in f: | ||
| key, value = line.strip().split(" ") |
Collaborator
There was a problem hiding this comment.
Maybe save in csv is a better idea, otherwise, the word cannot contain spaces.
It could be true since we could make some phrases as in our word dict.
Member
Author
There was a problem hiding this comment.
cool, will do this later
reyoung
approved these changes
Sep 15, 2017
Collaborator
reyoung
left a comment
There was a problem hiding this comment.
A little problem here. But do not break merge.
It can be fixed in another PR later.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.