How to use the new generated DL4J artifact in DL4J-examples project?

I have built and installed the DL4J project under Linux, and generated the ND4J artifacts like this:

Once I use the snapshot in the example project:

A test error is reported:

How can I use the new generated backend snapshot in dl4j-examples project? I am not familiar with pom file and maven. Thanks!

@yaoyao that’s all you should need to do. If you built it locally and installed it via maven like I mentioned there’s nothing else to do. You just specify the version and you’re done. Could you clarify what your exact problem is? The test failure above doesn’t tell me why it failed. I’d need more information to go off of. Can you post the full run?

Thanks for your help. Now, I modify nothing in ND4J, and generate the new jar package. And I can successfully compile the dl4j-examples project. However, when I run the by the command mvn exec:java -Dexec.mainClass=“org.deeplearning4j.examples.quickstart.modeling.convolution.LeNetMNIST” the error occurs:

What causes this? Maybe I lost something?

@yaoyao did you do something special like run mvn -pl :nd4j-native only? Your issue is due to using an old version of snapshots. It feels like you’re mixing old snapshots with the local source one. That shouldn’t happen if you run the build from the root.

I built the dl4j project just by command mvn clean install -DskipTests -T 40 as you suggested before, and the snapshots in my .m2/repo are all new-generated as shown:

But the error still occurs… :frowning:

@yaoyao you might have old dependencies laying around. Could you please rm -rf org/nd4j under your .m2 and rebuild just incase?

Note: I am not advocating for removing all your .m2. Just the org/nd4j folder.

I run the rm command, and the repo looks like (without nd4j):

and I built the nd4j in its root dir:

I will try it ASAP.

In dl4j-examples dir, I usually run mvn compile -T 40 to compile the project, is the command correct ?

(BTW, i need nearly 20minutes to compile the libnd4j, any methods can speedup it?)

@yaoyao You need to run with mvn -Pcpu nd4j-native is not included by default. I mentioned that earlier.

Edit: Please differentiate between the examples and dl4j. Note that rebuilding the examples won’t help you unless you’re using an uber jar.

In fact, I can build the DL4J project successfully.

Then i modify the pom file (from M2.1 to snapshot) in DL4J-examples dir, because I want to use the new built DL4J in examples.

The error is reported from DL4J-examples project, rather than DL4J project.

@yaoyao you’re ignoring why I told you to rebuild in the first place though. You need to regenerate the dl4j dependencies in order to use them.
I told you to regenerate those dependencies because you had old snapshots laying around that were incompatible with the current build.

I rebuilt & regenerated the dl4j project successfully now with your warmheart help. Please guide me what should I do/run which command next?

@yaoyao great then just rebuild the project with standard mvn clean install or if you’re using intellij just rerun the project with that and let me now what you get.

Thanks. I am rebuilding the project. But the make process for libnd4j is too slow, any method can speedup it?

It needs nearly 20+ minutes each time I build it …

@yaoyao Add -Dlibnd4j.buildthreads=4

That “4” can be however many cores you have on your computer. That’s equivalent to make -j if you’re familiar with that.

I have rebuilt the DL4J project now.

Please guide me how to use the new dl4j in DL4J-EXAMPLES project :smiling_face_with_three_hearts:

@yaoyao just rerun your code. Everything is automatically used correctly now. You just need that 1.0.0-SNAPSHOT specified and it needs to be the correct version of the snapshots.

I modify the version of nd4j-native in DL4J-examples pom.xml.

I want to confirm: You mean I don’t need to rebuilt the DL4J-examples project ? Just modify the version in pom?

I just modify the pom file. Then I run the java file, the mvn downloads some files like this:

The error still exists:

@yaoyao wait are you trying to use M2.1 with just nd4j-native as snapshots? Do not mix versions. Everything has to be the same.

I have changed all dl4j-related versions from M2.1 to SNAPSHOT