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

Multi Precision Lamb Update operator #16885

Merged
merged 4 commits into from
Dec 10, 2019

Conversation

access2rohit
Copy link
Contributor

@access2rohit access2rohit commented Nov 22, 2019

Description

adding to new operators:

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • 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)
  • Code is well-documented:
  • To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

Testing

$ MXNET_TEST_COUNT=1 nosetests --logging-level=DEBUG --verbose -s tests/python/unittest/test_optimizer.py:test_lamb
/home/ubuntu/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
[INFO] Setting module np/mx/python random seeds, use MXNET_MODULE_SEED=1104492960 to reproduce.
test_optimizer.test_lamb ... [DEBUG] Setting test np/mx/python random seeds, use MXNET_TEST_SEED=1864085207 to reproduce.
ok

----------------------------------------------------------------------
Ran 1 test in 9.091s

OK

@access2rohit access2rohit changed the title [WIP]Multi Precision Lamb Update operator Multi Precision Lamb Update operator Nov 25, 2019
@access2rohit
Copy link
Contributor Author

@mxnet-label-bot add [pr-awaiting-review]

@lanking520 lanking520 added the pr-awaiting-review PR is waiting for code review label Nov 25, 2019
@access2rohit
Copy link
Contributor Author

@eric-haibin-lin PR is ready for review

r2 = g.norm()
# calculate lamb_trust_ratio
r = 1. if r1 == 0. or r2 == 0. else r1 / r2
lr *= r
# update weight
weight[:] -= lr * g
if use_multi_precision:
Copy link
Member

Choose a reason for hiding this comment

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

why adding this?

mx_w32 = _make_ndarrays(weights32_arr)
mx_p_w32 = _make_ndarrays(weights32_arr)

mx.nd.multi_mp_lamb_update(
Copy link
Member

Choose a reason for hiding this comment

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

The test case does not make sense. There's no such an op multi_mp_lamb_update in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

forgot to remove old code :P
just removed

@access2rohit
Copy link
Contributor Author

@mxnet-label-bot add [pr-awaiting-merge]

@lanking520 lanking520 added the pr-awaiting-merge Review and CI is complete. Ready to Merge label Dec 10, 2019
@eric-haibin-lin eric-haibin-lin merged commit 248acfa into apache:master Dec 10, 2019
ptrendx pushed a commit to ptrendx/mxnet that referenced this pull request Dec 10, 2019
* multi-precision lamb update operator

* removing multi-tensor code from lamb

* doing operation beta^t outside of kernel call

* removing unecessary functions from PyLAMB
@ptrendx ptrendx mentioned this pull request Dec 10, 2019
eric-haibin-lin pushed a commit that referenced this pull request Dec 10, 2019
* multi-precision lamb update operator

* removing multi-tensor code from lamb

* doing operation beta^t outside of kernel call

* removing unecessary functions from PyLAMB
eric-haibin-lin pushed a commit to eric-haibin-lin/mxnet that referenced this pull request Dec 14, 2019
* multi-precision lamb update operator

* removing multi-tensor code from lamb

* doing operation beta^t outside of kernel call

* removing unecessary functions from PyLAMB
eric-haibin-lin added a commit to eric-haibin-lin/mxnet that referenced this pull request Dec 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr-awaiting-merge Review and CI is complete. Ready to Merge pr-awaiting-review PR is waiting for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants