UnsupportedOperationException while training

Hi, since updating to M1.1 a simple samediff training is giving me an error. Previously it worked without issues. I have a standard multi-lingual cased BERT model which I’m loading into sd with:

SameDiff sd = TFGraphMapper.importGraph(new ByteArrayInputStream(pretrainedModel));

The stacktrace is:
image

I guess this is related to the latest change documented here Fixes https://github.com/eclipse/deeplearning4j/issues/8876 by agibsonccc · Pull Request #9357 · eclipse/deeplearning4j · GitHub.

@lln Could you please try the new tensorflow import? That graph mapper was left there for backwards compatibility, but it’s suggested to try the new import.
See:

@agibsonccc Thanks for the reply. I refactored it to use TensorflowFrameworkImporter but I’m now getting an error

Caused by: java.io.FileNotFoundException: nd4j-op-def.pbtxt cannot be opened because it does not exist
	at org.nd4j.common.io.ClassPathResource.getInputStream(ClassPathResource.java:248)
	at org.nd4j.common.io.ClassPathResource.getInputStream(ClassPathResource.java:235)
	at org.nd4j.samediff.frameworkimport.tensorflow.opdefs.TensorflowOpDescriptorLoader.nd4jOpList(TensorflowOpDescriptorLoader.kt:55)
	at org.nd4j.samediff.frameworkimport.tensorflow.opdefs.TensorflowOpDescriptorLoader.<init>(TensorflowOpDescriptorLoader.kt:46)

@lln I’ve noticed that recently, for some reason the class path resource isn’t being resolved there. As a work around could you take this folder:

and put it in your src/main/resources and run it again? Thanks!

I’m working in the same project with @lln so i’m following up on this…

@agibsonccc thanks, that helps but we now have an other issue. I’m using the same model as @lln that worked with the import method of M1:

java.lang.IllegalArgumentException: Found invalid output tensor named permuteDims for rule ndarraymapping and mapping process for op transpose and input framework name Transpose with definition being name: “transpose”
argDescriptor {
name: “dtype”
argType: DATA_TYPE
}
argDescriptor {
name: “outputs”
argType: OUTPUT_TENSOR
}
argDescriptor {
name: “input”
argType: INPUT_TENSOR
}
argDescriptor {
name: “permutationVector”
argType: INPUT_TENSOR
argIndex: 1
}
argDescriptor {
name: “permuteDims”
argType: INT64
}

at org.nd4j.samediff.frameworkimport.process.AbstractMappingProcess.<init>(AbstractMappingProcess.kt:84)
at org.nd4j.samediff.frameworkimport.tensorflow.process.TensorflowMappingProcess.<init>(TensorflowMappingProcess.kt:49)
at org.nd4j.samediff.frameworkimport.tensorflow.process.TensorflowMappingProcess.<init>(TensorflowMappingProcess.kt:48)
at org.nd4j.samediff.frameworkimport.tensorflow.process.TensorflowMappingProcessLoader.instantiateMappingProcess(TensorflowMappingProcessLoader.kt:45)
at org.nd4j.samediff.frameworkimport.process.AbstractMappingProcessLoader.createProcess(AbstractMappingProcessLoader.kt:155)
at org.nd4j.samediff.frameworkimport.registry.OpMappingRegistry.loadFromDefinitions(OpMappingRegistry.kt:169)
at org.nd4j.samediff.frameworkimport.tensorflow.opdefs.TensorflowOpDescriptorLoader.createOpMappingRegistry(TensorflowOpDescriptorLoader.kt:105)
at org.nd4j.samediff.frameworkimport.tensorflow.importer.TensorflowFrameworkImporter.<init>(TensorflowFrameworkImporter.kt:45)