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

[MXNET-531] add initial demo files #11451

Merged
merged 11 commits into from
Jul 4, 2018
Merged

Conversation

lanking520
Copy link
Member

@lanking520 lanking520 commented Jun 28, 2018

Description

A simple demo folder contains all you need to start a Scala project with maven
@nswamy @yzhliu @andrewfayres

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

@lanking520 lanking520 requested a review from yzhliu as a code owner June 28, 2018 06:42
#!/bin/bash
CURR_DIR=$(cd $(dirname $0); pwd)
CLASSPATH=$CLASSPATH:$CURR_DIR/target/*:$CLASSPATH:$CURR_DIR/target/classes/lib/*
java -Xmx8G -cp $CLASSPATH sample.HelloWorld
Copy link
Member

Choose a reason for hiding this comment

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

CPU/GPU flag like we did for examples?

object HelloWorld {
def main(args: Array[String]): Unit = {
println("hello World")
val arr = NDArray.ones(2, 3)
Copy link
Member

Choose a reason for hiding this comment

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

pass context based on CPU/GPU flag like examples?

@@ -0,0 +1,4 @@
#!/bin/bash
Copy link
Member

Choose a reason for hiding this comment

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

rename folder from demo to maven-demo?

@nswamy
Copy link
Member

nswamy commented Jun 29, 2018

Also please test on linux

<properties>
<mxnet.profile>osx-x86_64-cpu</mxnet.profile>
<mxnet.version>1.2.0</mxnet.version>
<scala.version>2.12.5</scala.version>
Copy link
Member

Choose a reason for hiding this comment

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

why 2.12.5 ? we support 2.11.8

endif
endif

ifeq ($(USE_CUDA), 1)
Copy link
Member

Choose a reason for hiding this comment

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

bash bin/demo.sh
```
It will load the library automatically and run the example
### Image Classification using Inference API
Copy link
Member

Choose a reason for hiding this comment

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

If we are just copying the entire ImageClassification Example, we don't need to maintain it in two different places. I think it is redundant, lets remove this and just keep the HelloWorld
I was thinking of a more self contained code which downloads and runs the model on a fixed image.

Copy link
Member Author

Choose a reason for hiding this comment

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

Your thinking now come true :)

Copy link
Member

Choose a reason for hiding this comment

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

thanks, you rock 👍

# under the License.

SCALA_VERSION_PROFILE := 2.11
SCALA_VERSION := 2.11.8
Copy link
Member

Choose a reason for hiding this comment

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

Can we just use one SCALA_VERSION It should work with Scala 2.11.x

Copy link
Member Author

Choose a reason for hiding this comment

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

Maven cannot find a scala-library if you just fill in 2.11.

```
It will load the library automatically and run the example
### Image Classification using Inference API
We also provide an example to do image classification.
Copy link
Member

@nswamy nswamy Jul 3, 2018

Choose a reason for hiding this comment

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

We also provide an example to do image classification, which downloads a ImageNet trained resnet18 model and runs inference on a cute puppy to return the classification result as
result
add what the customer should expect
You can review the complete example here

*/
object ImageClassificationExample {

def downloadImage() : String = {
Copy link
Member

Choose a reason for hiding this comment

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

can you create one downloadUrl method instead of separate ?, we can move this to a TestUtils method and add hash check etc., later
downloadUrl(downloadFrom, downloadTo)

@nswamy nswamy merged commit 9e681f2 into apache:master Jul 4, 2018
@lanking520 lanking520 deleted the scala-demo branch July 5, 2018 16:15
XinYao1994 pushed a commit to XinYao1994/incubator-mxnet that referenced this pull request Aug 29, 2018
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.

2 participants