-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Description
Hey everybody.
I am running into an issue when loading a simple python keras model.
Python keras model:
`model = keras.Sequential([
keras.layers.Dense(32, activation='relu', input_shape=(132,)),
keras.layers.Dropout(.2),
keras.layers.Dense(16, activation='relu'),
keras.layers.Dense(41, activation='softmax')
])
optimizer = SGD(learning_rate=0.1)
model.compile(optimizer=optimizer, loss=keras.losses.sparse_categorical_crossentropy, metrics=['accuracy'])
model.fit(train_x, train_y, epochs=10, batch_size=32, validation_split=0.1)
test_loss, test_accuracy = model.evaluate(test_x, test_y)
print(f"Test accuracy: {test_accuracy}")
model.save("test_model.h5")`
Java code that gives me the error:
MultiLayerNetwork model = KerasModelImport.importKerasSequentialModelAndWeights("path/to/model.h5");
The error itself:
org.deeplearning4j.nn.modelimport.keras.exceptions.UnsupportedKerasConfigurationException
The error message: Optimizer with name Custom>SGDcan not bematched to a DL4J optimizer. Note that custom TFOptimizers are not supported by model import.
Version Information
Windows 10 x64
JDK 21
My dependencies look like this:
https://gist.github.com/YusifCodes/1c275a810b5c966c50fb4303ae3143a7
Note: I used dl4j 1.0.0-M2.1, 1.0.0-beta6, 1.0.0-beta7 previously got the same error. I also replaced Adam with SGD, still no luck.
I relly wish we can resolve this issue, thanks!