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

Updating MultiTask example to use new infer api and adding test for CI #11605

Merged
merged 2 commits into from Jul 22, 2018

Conversation

andrewfayres
Copy link
Contributor

@andrewfayres andrewfayres commented Jul 7, 2018

Description

Updated the multitask example to use the new inference api. Also added a test case that will run the example.

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://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

  • Feature1, tests, (and when applicable, API doc)
  • Feature2, tests, (and when applicable, API doc)

Comments

  • If this change is a backward incompatible change, why must this change be made.
  • Interesting edge cases to note here


val batchSize = 100
val numEpoch = 10
val ctx = Context.cpu()
Copy link
Contributor

Choose a reason for hiding this comment

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

@nswamy is there an auto context in Scala?

Copy link
Member

Choose a reason for hiding this comment

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

we don't have auto context, we planned to run these examples only on GPUs since it takes more time on CPU, We currently control this using a environment variable that is passed from a script. We will be moving away from this model with #11596

Copy link
Member

Choose a reason for hiding this comment

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

what is auto context?

Copy link
Contributor

Choose a reason for hiding this comment

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

Auto context is a method we use in our Python frontend where the context gets globally defined. The script then takes this configuration and uses it instead having the context explicitly defined.

Otherwise you run into the problem that you are not able to test the same code on CPU and GPU without having to make a Switch somewhere.

Thanks for elaborating, Naveen. I agree that GPU would make sense here. At the moment, it states CPU - is that a mistake or on purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did CPU on purpose because this is training on MNIST data. It trains on my macbook in just a few minutes.

This is consistent with the other example that we have that uses mnist here.

@marcoabreu
Copy link
Contributor

Thanks a lot for adding the examples to our CI. In general, I really like the idea and would like to strive for having all examples in CI. I'm just a bit concerned that the training time in our examples could cause some problems, thus, in the long term I'd like to move them into a separate job.


val datasAndLabels = trainMultiIter.provideData ++ trainMultiIter.provideLabel

val (argShapes, outputShapes, auxShapes) = network.inferShape(trainMultiIter.provideData("data"))
Copy link
Member

Choose a reason for hiding this comment

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

bulk of the code in this file is training code, can you move it to generic runTraining method inside of the example, so customers can directly use it? you can call the runTraining code by passing training/test files, etc.,

@yzhliu
Copy link
Member

yzhliu commented Jul 11, 2018

Can we move test code to test package and name it XXXSuite` to follow the Scala test convention?

@nswamy nswamy merged commit 7c1a49b into apache:master Jul 22, 2018
XinYao1994 pushed a commit to XinYao1994/incubator-mxnet that referenced this pull request Aug 29, 2018
apache#11605)

* Updating MultiTask example to use new infer api and adding test for CI

* Moved common multitask code into methods. Changed multitask test to scala suite convention
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.

None yet

4 participants