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

remove mod from arity 2 version of load-checkpoint in clojure-package #11808

Merged
merged 2 commits into from
Aug 2, 2018

Conversation

jimdunn
Copy link
Contributor

@jimdunn jimdunn commented Jul 18, 2018

Description

The arity 1 version of load-checkpoint in the module namespace works, but the arity 2 version just calls itself. Probably not noticed because mod is a clojure function, though it's used throughout the code as a variable name for modules.
Just needed to delete that mod, and arity 2 version properly calls the arity 1 version.

@gigasquid
Copy link
Member

@jimdunn Thanks so much for finding and fixing this 😸

We've been trying to improve the coverage of our unit tests, would you mind adding a test for this arity to make sure it doesn't break again? https://github.com/apache/incubator-mxnet/blob/master/contrib/clojure-package/test/org/apache/clojure_mxnet/module_test.clj#L105

@jimdunn
Copy link
Contributor Author

jimdunn commented Jul 30, 2018

Oh sure no problem. I'll take care of that in the next day or two.

@jimdunn
Copy link
Contributor Author

jimdunn commented Jul 31, 2018

@gigasquid Hey, I have a question about those tests. The arity 2 function has load-optimizer-states as false, which is the default. So I initially thought it might not pass the test because it wouldn't load the optimizer states, but apparently the optimizer state isn't actually checked since my test worked ok.

So I wondered if there was a point of the init-optimizer bit in those tests and found that removing those lines didn't have an effect.
https://github.com/apache/incubator-mxnet/blob/master/contrib/clojure-package/test/org/apache/clojure_mxnet/module_test.clj#L108
I saw that the scala tests for this are basically identical. I tried to run them to see if to see if they would be fine without the initOptimizer step, but I was unable to figure out the scala pacakge install and I don't have time to spend on that.

In any case, I'm not sure what the best thing to do is. I can just add my test "as is" and not worry about this apparently unnecessary step, or even remove that step from the test. But if it's supposed to matter and we care about the optimizer state for these tests, then that should be fixed. The problem for me with this is that I can't see how to access the optimizer state in mod to make the comparison.

Maybe I'm making too much of it, but I found it confusing that this load-optimizer-states is explicitly set in the test and neither it nor the init-optimizer step affect the success of the test.

Am I making sense? Thoughts on this?

@gigasquid
Copy link
Member

Makes total sense. Looking at the code for this, it is not very easy to test that the optimizer states are loaded. Basically, the optimizer states are serialized to atest-0000.states file and then loaded into the model. It sets a private variable called preloadOptStates which is then used in the init-optimizer https://github.com/apache/incubator-mxnet/blob/master/scala-package/core/src/main/scala/org/apache/mxnet/module/Module.scala#L404 to set it.

Unfortunately, I can't find a good way to verify this in the tests so I would just recommend to leave them as is unless someone else has a better idea.

Thanks for digging into this and enhancing the tests to make them better 👍 .

@jimdunn
Copy link
Contributor Author

jimdunn commented Aug 1, 2018

No problemo. I'm enjoying playing around with this package.
Yeah I figured just leaving them would probably be best for now. I just wanted to bring it up in case I missed something obvious. Little things like that really bug me, but I am sadly not equipped to dig any deeper into this matter right now.

@gigasquid
Copy link
Member

This looks good from the Clojure point of view. It's ready for @nswamy or @szha to review.

@nswamy nswamy merged commit 833de7e into apache:master Aug 2, 2018
aaronmarkham pushed a commit to aaronmarkham/incubator-mxnet that referenced this pull request Aug 6, 2018
…apache#11808)

* remove mod from arity 2 version of load-checkpoint

* load-checkpoint arity 2 test
aaronmarkham added a commit to aaronmarkham/incubator-mxnet that referenced this pull request Aug 7, 2018
[MXNET-750] fix nested call on CachedOp. (apache#11951)

* fix nested call on cachedop.

* fix.

extend reshape op to allow reverse shape inference (apache#11956)

Improve sparse embedding index out of bound error message; (apache#11940)

[MXNET-770] Remove fixed seed in flaky test (apache#11958)

* Remove fixed seed in flaky test

* Remove fixed seed in flaky test

Update ONNX docs with the latest supported ONNX version (apache#11936)

Reduced test to 3 epochs and made gpu only (apache#11863)

* Reduced test to 3 epochs and made GPU only

* Moved logger variable so that it's accessible

Fix flaky tests for test_laop_4 (apache#11972)

Updating R client docs (apache#11954)

* Updating R client docs

* Forcing build

Fix install instructions for MXNET-R (apache#11976)

* fix install instructions for MXNET-R

* fix install instructions for MXNET-R

* fix default cuda version for MXNet-R

[MXNET-751] fix ce_loss flaky (apache#11971)

* add xavier initializer

* remove comment line

[MXNET-769] set MXNET_HOME as base for downloaded models through base.data_dir() (apache#11636)

* set MXNET_DATA_DIR as base for downloaded models through base.data_dir()
push joblib to save containers so is not required when running

* MXNET_DATA_DIR -> MXNET_HOME

[MXNET-748] linker fixed on Scala issues (apache#11989)

* put force load back as a temporary solution

* use project.basedir as relative path for OSX linker

[MXNET-772] Re-enable test_module.py:test_module_set_params (apache#11979)

[MXNET-771] Fix Flaky Test test_executor.py:test_dot (apache#11978)

* use assert_almost_equal, increase rtol, reduce matrix size

* remove seed in test_bind

* add seed 0 to test_bind, it is still flaky

* add comments for tracking

remove mod from arity 2 version of load-checkpoint in clojure-package (apache#11808)

* remove mod from arity 2 version of load-checkpoint

* load-checkpoint arity 2 test

Add unit test stage for mxnet cpu in debug mode (apache#11974)

Website broken link fixes (apache#12014)

* fix broken link

* fix broken link

* switch to .md links

* fix broken link

removed seed from flaky test (apache#11975)

Disable ccache log print due to threadunsafety (apache#11997)

Added default tolerance levels for regression checks for MBCC (apache#12006)

* Added tolerance level for assert_almost_equal for MBCC

* Nudge to CI

Disable flaky mkldnn test_requantize_int32_to_int8 (apache#11748)

[MXNET-769] Usability improvements to windows builds (apache#11947)

* Windows scripted build
Adjust Jenkins builds to use ci/build_windows.py

Issues:

    apache#8714
    apache#11100
    apache#10166
    apache#10049

* Fix bug

* Fix non-portable ut

* add xunit

Fix import statement (apache#12005)

array and multiply are undefined. Importing them from
ndarray

Disable flaky test test_random.test_gamma_generator (apache#12022)

[MXNET-770] Fix flaky test: test_factorization_machine_module (apache#12023)

* Remove fixed seed in flaky test

* Remove fixed seed in flaky test

* Update random seed to reproduce the issue

* Fix Flaky unit test and add a training test

* Remove fixed seed in flaky test

* Update random seed to reproduce the issue

* Fix Flaky unit test and add a training test

* Increase accuracy check

disable opencv threading for forked process (apache#12025)

Bug fixes in control flow operators (apache#11942)

Fix data narrowing warning on graph_executor.cc (apache#11969)

Fix flaky tests for test_squared_hinge_loss (apache#12017)

Fix flaky tests for test_hinge_loss (apache#12020)

remove fixed seed for test_sparse_ndarray/test_operator_gpu.test_sparse_nd_pickle (apache#12012)

Removed fixed seed from , test_loss:test_ctc_loss_train (apache#11985)

Removed fixed seed from , test_loss:test_sample_weight_loss (apache#11986)

Fix reduce_kernel_M1 (apache#12026)

* Fix reduce_kernel_M1

* Improve test_norm

Update test_loss.py to remove fixed seed (apache#11995)

[MXNET-23] Adding support to profile kvstore server during distributed training  (apache#11215)

* server profiling

merge with master

cleanup old code

added a check and better info message

add functions for C compatibility

fix doc

lint fixes

fix compile issues

lint fix

build error

update function signatures to preserve compatibility

fix comments

lint

* add part1 of test

* add integration test

Re-enabling test_ndarray/test_cached (apache#11950)

Test passes on CPU and GPU (10000 runs)

make gluon rnn layers hybrid blocks (apache#11482)

* make Gluon RNN layer hybrid block

* separate gluon gpu tests

* remove excess assert_raises_cudnn_disabled usage

* add comments and refactor

* add bidirectional test

* temporarily remove hybridize in test_gluon_rnn.test_layer_fill_shape

[MXNET-751] fix bce_loss flaky (apache#11955)

* add fix to bce_loss

* add comments

* remove unecessary comments

Doc fix for a few optimizers (apache#12034)

* Update optimizer.py

* Update optimizer.py
XinYao1994 pushed a commit to XinYao1994/incubator-mxnet that referenced this pull request Aug 29, 2018
…apache#11808)

* remove mod from arity 2 version of load-checkpoint

* load-checkpoint arity 2 test
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants