I am trying to use the OnnxFrameworkImporter to import DistilBERT, with no luck. It seems like some operations are not recognized.
Here’s the model I’m trying to import: philschmid/distilbert-onnx at main
Code:
import org.junit.Test;
import org.nd4j.autodiff.samediff.SameDiff;
import org.nd4j.samediff.frameworkimport.onnx.importer.OnnxFrameworkImporter;
/**
* Unit test for simple App.
*/
public class AppTest
{
@Test
public void loadModel() {
String modelPath = "distilbert-base-cased.onnx";
OnnxFrameworkImporter onnxFrameworkImporter = new OnnxFrameworkImporter();
SameDiff graph = onnxFrameworkImporter.runImport(modelPath, Collections.emptyMap(), true);
assertTrue(graph != null);
}
}
Error messages:
Unable to resolve attribute for name keepdims for node ReduceMean for op type ReduceMean
Unable to resolve attribute for name keepdims for node ReduceMean for op type ReduceMean
Unable to resolve attribute for name keepdims for node ReduceMean for op type ReduceMean
Unable to resolve attribute for name keepdims for node ReduceMean for op type ReduceMean
Unable to resolve attribute for name keepdims for node ReduceMean for op type ReduceMean
Unable to resolve attribute for name keepdims for node ReduceMean for op type ReduceMean
Unable to resolve attribute for name keepdims for node ReduceMean for op type ReduceMean
Unable to resolve attribute for name keepdims for node ReduceMean for op type ReduceMean
Unable to resolve attribute for name keepdims for node ReduceMean for op type ReduceMean
Unable to resolve attribute for name keepdims for node ReduceMean for op type ReduceMean
Unable to resolve attribute for name keepdims for node ReduceMean for op type ReduceMean
Unable to resolve attribute for name keepdims for node ReduceMean for op type ReduceMean
Unable to resolve attribute for name keepdims for node ReduceMean for op type ReduceMean
Unable to resolve attribute for name keepdims for node ReduceMean for op type ReduceMean
Unable to resolve attribute for name keepdims for node ReduceMean for op type ReduceMean
Unable to resolve attribute for name keepdims for node ReduceMean for op type ReduceMean
Node with name Squeeze for opdef with name Squeeze did not contain a tensor with name axes, returning empty tensor
Node with name Squeeze for opdef with name Squeeze did not contain a tensor with name axes, returning empty tensor
[WARNING] Corrupted STDOUT by directly writing to native stream in forked JVM 1. See FAQ web page and the dump file /home/gregb/ToughdataLLC/Projects/tiktok-video-post-captcha/testdl4j/targ
et/surefire-reports/2024-08-17T14-33-33_015-jvmRun1.dumpstream
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 11.372 s <<< FAILURE! - in com.sadcaptcha.testdl4j.AppTest
[ERROR] loadModel(com.sadcaptcha.testdl4j.AppTest) Time elapsed: 11.327 s <<< ERROR!
java.lang.RuntimeException: Op [gather] execution failed
at com.sadcaptcha.testdl4j.AppTest.loadModel(AppTest.java:22)
Caused by: java.lang.RuntimeException: Op with name Gather_8 and op type [gather] execution failed with message Op validation failed
at com.sadcaptcha.testdl4j.AppTest.loadModel(AppTest.java:22)
If anyone could point me in the right direction, that would be great. Would love to get this up and running in Java.