Skip to content
This repository was archived by the owner on Nov 22, 2022. It is now read-only.

edited target names during caffe2 export #780

Closed

Conversation

shreydesai
Copy link
Contributor

Summary:
The caffe2 predict_net can't be run more than once if a) a vocabulary item has the same name as a caffe2 cell and b) the target names (i.e. vocabulary) is exported along with the model.

For an example, let's say our vocabulary contains the word "10" and there is also a cell 10 in the caffe2 graph not associated with the vocab word. When the caffe2 model generates predictions, it will write word 10's score to its associated cell, which also happens to be called cell 10. Because of this, the original cell 10's contents will be overwritten, causing issues in the next run of the predict_net.

This diff introduces a fix by appending an underscore to the beginning of each vocabulary item, ensuring that its name will not conflict with existing cell names in the graph.

Differential Revision: D16257838

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Jul 15, 2019
shreydesai added a commit to shreydesai/pytext that referenced this pull request Jul 15, 2019
Summary:
Pull Request resolved: facebookresearch#780

The caffe2 predict_net can't be run more than once if a) a vocabulary item has the same name as a caffe2 cell and b) the target names (i.e. vocabulary) is exported along with the model.

For an example, let's say our vocabulary contains the word "10" and there is also a cell 10 in the caffe2 graph not associated with the vocab word. When the caffe2 model generates predictions, it will write word 10's score to its associated cell, which also happens to be called cell 10. Because of this, the original cell 10's contents will be overwritten, causing issues in the next run of the predict_net.

This diff introduces a fix by appending an underscore to the beginning of each vocabulary item, ensuring that its name will not conflict with existing cell names in the graph.

Differential Revision: D16257838

fbshipit-source-id: 680b8f9b58ec98f8f53f05c55055a5258933c23d
Summary:
Pull Request resolved: facebookresearch#780

The caffe2 predict_net can't be run more than once if a) a vocabulary item has the same name as a caffe2 cell and b) the target names (i.e. vocabulary) is exported along with the model.

For an example, let's say our vocabulary contains the word "10" and there is also a cell 10 in the caffe2 graph not associated with the vocab word. When the caffe2 model generates predictions, it will write word 10's score to its associated cell, which also happens to be called cell 10. Because of this, the original cell 10's contents will be overwritten, causing issues in the next run of the predict_net.

This diff introduces a fix by appending an underscore to the beginning of each vocabulary item, ensuring that its name will not conflict with existing cell names in the graph.

Reviewed By: seayoung1112

Differential Revision: D16257838

fbshipit-source-id: 8fde28c199611c4706aca02a95c1a171af5aae4f
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in d621095.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed Do not delete this pull request or issue due to inactivity. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants