Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

hybridize rnn and add model graph #13244

Merged
merged 7 commits into from
Feb 7, 2019
Merged

Conversation

yifeim
Copy link
Contributor

@yifeim yifeim commented Nov 13, 2018

Description

Add hybridize option and visualize the network in mxnet>=1.3.

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant JIRA issue created (except PRs with tiny changes)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
  • Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
  • Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
  • Code is well-documented:
  • For user-facing API changes, API doc string has been updated.
  • For new C++ functions in header files, their functionalities and arguments are documented.
  • For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
  • Check the API doc at http:https://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

Changes

  • Add hybridize option. Hybridize on RNN layers is newly available in mxnet>=1.3.
  • Add model export to mxboard. The end result is visualized via tensorboard and added to README.

Comments

  • The change is back-ward compatible. Especially, hybridize_optional would be an empty list in mxnet<1.3.

@yifeim yifeim requested a review from szha as a code owner November 13, 2018 04:22
@kalyc
Copy link
Contributor

kalyc commented Nov 15, 2018

Hi @yifeim could you please re-trigger CI to ensure that the build succeeds?

@kalyc
Copy link
Contributor

kalyc commented Nov 15, 2018

@mxnet-label-bot add [pr-work-in-progress]

@marcoabreu marcoabreu added the pr-work-in-progress PR is still work in progress label Nov 15, 2018
@stu1130
Copy link
Contributor

stu1130 commented Nov 20, 2018

@mxnet-label-bot update [pr-awaiting-review, gluon]

@marcoabreu marcoabreu added Gluon pr-awaiting-review PR is waiting for code review and removed pr-work-in-progress PR is still work in progress labels Nov 20, 2018
@@ -28,7 +28,9 @@ python train.py --cuda --tied --nhid 650 --emsize 650 --epochs 40 --dropout 0.5
```
python train.py --cuda --tied --nhid 1500 --emsize 1500 --epochs 60 --dropout 0.65 # Test ppl of 88.42
```

```
python train.py --export-only # hybridize and export model graph (requires mxboard)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add instruction to install mxboard

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added link and made it outside of the main codes.

parser.add_argument('--static-shape', action='store_true',
help='whether to use static-shape hybridize in mxnet>=1.3')
parser.add_argument('--export-only', action='store_true',
help='export a symbol graph and exit')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please mention the default values for all of these arguments

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added defaults as directed.

@vandanavk
Copy link
Contributor

@roywei for review

@yifeim
Copy link
Contributor Author

yifeim commented Nov 30, 2018

Is this related to my PR?
http:https://jenkins.mxnet-ci.amazon-ml.com/blue/organizations/jenkins/incubator-mxnet/detail/PR-13244/5/pipeline

[INFO] Setting module np/mx/python random seeds, use MXNET_MODULE_SEED=1716360676 to reproduce.
test_gluon_model_zoo_gpu.test_inference ... [02:33:54] src/io/iter_image_recordio_2.cc:172: ImageRecordIOParser2: data/val-5k-256.rec, use 1 threads for decoding..
[02:33:57] src/operator/nn/mkldnn/mkldnn_base.cc:74: Allocate 32112640 bytes with malloc directly
[02:34:03] src/io/iter_image_recordio_2.cc:172: ImageRecordIOParser2: data/val-5k-256.rec, use 1 threads for decoding..
Sending interrupt signal to process
build.py: 2018-11-27 02:34:52,714 Signal 15 received, cleaning up...
build.py: 2018-11-27 02:34:52,714 Cleaning up containers
Terminated
build.py: 2018-11-27 02:34:57,229 ☠: stopped container 3c9b21b903de
build.py: 2018-11-27 02:34:57,290 🚽: removed container 3c9b21b903de
build.py: 2018-11-27 02:34:57,291 Cleaning up containers finished.
build.py: 2018-11-27 02:34:57,291 done. Exiting with error.
script returned exit code 143

@roywei
Copy link
Member

roywei commented Dec 11, 2018

@yifeim Thanks for the contribution. Is there any performance improvement after hybridize? Btw, you can trigger CI again by rebase or push an empty commit.

@yifeim
Copy link
Contributor Author

yifeim commented Dec 11, 2018 via email

Copy link
Contributor

@sandeep-krishnamurthy sandeep-krishnamurthy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contributions. 2 questions.

  1. Why should Hybridize even be an option? Why can't we just have it as default?
  2. export only is confusing or mis-leading. export is referred to a model (network + params) not just network. And, why is this option required?

@yifeim
Copy link
Contributor Author

yifeim commented Dec 29, 2018 via email

@sandeep-krishnamurthy
Copy link
Contributor

  1. As noted in both README and help strings, hybridizing an RNN is not supported in mxnet<=1.2. 2. Export is the most obvious way for me to dump a network, unless you recommend a different approach that I am not aware of?

    On Sat, Dec 29, 2018 at 10:56 AM Sandeep Krishnamurthy < @.> wrote: @.* commented on this pull request. Thanks for your contributions. 2 questions. 1. Why should Hybridize even be an option? Why can't we just have it as default? 2. export only is confusing or mis-leading. export is referred to a model (network + params) not just network. And, why is this option required? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#13244 (review)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AIiQ6h7cUg0YOocWN_KGkUfSHxXLuo1mks5u97rHgaJpZM4Ya48l .
  1. Yes, that makes sense. Thanks.
  2. Export is fine. What I meant is 'export_only' does not convey that only network is exported.

@yifeim
Copy link
Contributor Author

yifeim commented Dec 29, 2018 via email

@yifeim
Copy link
Contributor Author

yifeim commented Dec 29, 2018 via email

@yifeim
Copy link
Contributor Author

yifeim commented Dec 29, 2018 via email

@anirudhacharya
Copy link
Member

@sandeep-krishnamurthy can you please review/merge this PR?

@yifeim
Copy link
Contributor Author

yifeim commented Jan 24, 2019

@sandeep-krishnamurthy Thanks for the reviews so far. I agree with you but I am very confused what is exactly needed here. Please let me know how I can help. Thanks.

@sandeep-krishnamurthy
Copy link
Contributor

sandeep-krishnamurthy commented Feb 6, 2019

@yifeim - Sorry for delayed response.
Rather than calling it "export_only", can we call it "export-model"? So it will be more clear for users?

Rest of changes LGTM. I was only concerned that "export_only" is not very intuitive word that gives the meaning of what that option does.

Copy link
Contributor

@sandeep-krishnamurthy sandeep-krishnamurthy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!
LGTM

@sandeep-krishnamurthy sandeep-krishnamurthy merged commit 506a25c into apache:master Feb 7, 2019
stephenrawls pushed a commit to stephenrawls/incubator-mxnet that referenced this pull request Feb 16, 2019
* hybridize rnn and add model graph

* trigger CI

* separate mxboard visualization

* add options and she-bang

* add defaults

* trigger CI

* rename export-model
vdantu pushed a commit to vdantu/incubator-mxnet that referenced this pull request Mar 31, 2019
* hybridize rnn and add model graph

* trigger CI

* separate mxboard visualization

* add options and she-bang

* add defaults

* trigger CI

* rename export-model
haohuanw pushed a commit to haohuanw/incubator-mxnet that referenced this pull request Jun 23, 2019
* hybridize rnn and add model graph

* trigger CI

* separate mxboard visualization

* add options and she-bang

* add defaults

* trigger CI

* rename export-model
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Gluon pr-awaiting-review PR is waiting for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants