Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The name of variables in net is prefixed by 'model' #27

Closed
as754770178 opened this issue Nov 7, 2018 · 6 comments
Closed

The name of variables in net is prefixed by 'model' #27

as754770178 opened this issue Nov 7, 2018 · 6 comments

Comments

@as754770178
Copy link

I define my net, but the name of variable is Prefixed of 'model', such as 'model/resnet_v1_110/block1/unit_1/bottleneck2_v1/conv1/BatchNorm/beta ', but it should is 'resnet_v1_110/block1/unit_1/bottleneck2_v1/conv1/BatchNorm/beta '.

`NotFoundError (see above for traceback): Restoring from checkpoint failed. This is most likely due to a Variable name or other graph key that is missing from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:

Key model/resnet_v1_110/block1/unit_1/bottleneck2_v1/conv1/BatchNorm/beta not found in checkpoint
[[Node: model/save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_model/save/Const_0_0, model/save/RestoreV2/tensor_names, model/save/RestoreV2/shape_and_slices)]]
[[Node: model/save/RestoreV2/_1059 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_1064_model/save/RestoreV2", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]`

@jiaxiang-wu
Copy link
Contributor

jiaxiang-wu commented Nov 7, 2018

The checkpoint files are generated by your own code, instead of FullPrecLearner in PocketFlow? This is different from what we expected. Sorry for the trouble.

A quick work-around is to rename all the variables in the checkpoint files. You may refer to the __rename_var_scope function from DistillationHelper class as the reference implementation.
Link: https://github.com/Tencent/PocketFlow/blob/master/learners/distillation_helper.py#L123

@as754770178
Copy link
Author

I want to change the code of Pocketflow to delete the prefix 'model', Where do I need to modify?

@jiaxiang-wu
Copy link
Contributor

Which learner are you using? Be careful, removing the name scope "model" may cause unexpected errors.

@as754770178
Copy link
Author

--learner dis-chn-pruned
I can not found the statement that add the prefix 'model', could you tell me.

@jiaxiang-wu
Copy link
Contributor

The prefix is defined in the AbstractLearner class, line 64:
https://github.com/Tencent/PocketFlow/blob/master/learners/abstract_learner.py#L64

@as754770178
Copy link
Author

OK, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants