Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DL4J Keras model import with CUDA backend strange behavior (0.9.2-SNAPSHOT) #4558

Closed
emc5ud opened this issue Jan 26, 2018 · 5 comments
Closed
Labels
Bug Bugs and problems DL4J Keras Issues related to Keras import

Comments

@emc5ud
Copy link

emc5ud commented Jan 26, 2018

This issue is a little strange.

So I trained a model in keras with tensorflow as a backend and would like to import it to DL4J. This works when I set my backend to be "nd4j-native", but fails when I set by backend as "nd4j-cuda-8.0".

I create the model in the following way: unet.py (training omitted). And load it into DL4J as so

  def getModel() = {
    KerasModelImport.importKerasModelAndWeights("src/main/resources/unet.h5", false)
  }

When I load the model in DL4J with GPUs enabled, process hangs at the above step. I've waited for about 10 minutes with no luck, and all the while the process uses a steady 6-7 GB of my GPU's memory.

Now the strange part is that when I create the model in Keras with "tf" ordering (aka channels last) the hang up no longer happens and everything is great (unet_tf_ordering.py). When I use CPU it doesn't care what ordering I use.

Relevant python libraries:

  • keras==1.2.2
  • tensorflow-gpu==1.4

Relevant part of my build.sbt:

libraryDependencies ++= Seq(
  "org.deeplearning4j" % "deeplearning4j-core" % "0.9.2-SNAPSHOT",
  "org.deeplearning4j" % "deeplearning4j-modelimport" % "0.9.2-SNAPSHOT",
  "org.nd4j" % "nd4j-cuda-8.0" % "0.9.2-SNAPSHOT" classifier "" classifier "linux-x86_64",
  "org.bytedeco.javacpp-presets" % "cuda" % "8.0-6.0-1.3" classifier "" classifier "linux-x86_64"
//  "org.nd4j" % "nd4j-native" % "0.9.2-SNAPSHOT" classifier "" classifier "linux-x86_64",
//  "org.bytedeco.javacpp-presets" % "mkl" % "2017.3-1.3" classifier "" classifier "linux-x86_64",
//  "org.bytedeco.javacpp-presets" % "openblas" % "0.2.20-1.3" classifier "" classifier "linux-x86_64"
)
@emc5ud emc5ud changed the title DL4J Keras Model Import with CUDA backend strange behavior (0.9.2-SNAPSHOT) DL4J Keras model import with CUDA backend strange behavior (0.9.2-SNAPSHOT) Jan 26, 2018
@maxpumperla maxpumperla self-assigned this Jan 26, 2018
@maxpumperla maxpumperla added the DL4J Keras Issues related to Keras import label Jan 26, 2018
@maxpumperla
Copy link
Contributor

Hey @emc5ud we had an HDF5 fix recently (here: #4870), would you mind checking the import again with CUDA? I have a hunch this will fix it.

@maxpumperla
Copy link
Contributor

@emc5ud could you please give it a try on your end? thanks

@emc5ud
Copy link
Author

emc5ud commented Apr 19, 2018

Hi Max, sorry for the delay. I'll give it a try this weekend.

@maxpumperla maxpumperla added the Bug Bugs and problems label May 15, 2018
@maxpumperla
Copy link
Contributor

@emc5ud hey, any feedback for me on this? This seems resolved, but feel free to reopen, OK? Thanks

@lock
Copy link

lock bot commented Sep 22, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Sep 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Bugs and problems DL4J Keras Issues related to Keras import
Projects
None yet
Development

No branches or pull requests

2 participants