You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by rz...@apache.org on 2023/11/28 07:31:26 UTC

(opennlp) 01/01: OPENNLP-1516 - Provide a ONNX runtime module for opennlp-dl Execute JUnit + Eval Tests on the new GPU-accelerated packages as well.

This is an automated email from the ASF dual-hosted git repository.

rzo1 pushed a commit to branch OPENNLP-1516
in repository https://gitbox.apache.org/repos/asf/opennlp.git

commit 5853614aaceb1755af3051fe976f2088581a5ad7
Author: Richard Zowalla <ri...@hs-heilbronn.de>
AuthorDate: Tue Nov 28 08:18:46 2023 +0100

    OPENNLP-1516 - Provide a ONNX runtime module for opennlp-dl
    Execute JUnit + Eval Tests on the new GPU-accelerated packages as well.
---
 opennlp-dl-gpu/README.md               | 13 ++++++
 {opennlp-dl => opennlp-dl-gpu}/pom.xml | 72 ++++++++++++++++++++++++++++------
 opennlp-dl/pom.xml                     | 17 ++++++++
 pom.xml                                |  1 +
 4 files changed, 90 insertions(+), 13 deletions(-)

diff --git a/opennlp-dl-gpu/README.md b/opennlp-dl-gpu/README.md
new file mode 100644
index 00000000..e44cdd3b
--- /dev/null
+++ b/opennlp-dl-gpu/README.md
@@ -0,0 +1,13 @@
+# OpenNLP DL (GPU)
+
+This module brings in `onnxruntime_gpu` bindings to the existing `opennlp-dl` module. If you are planning to run with GPU acceleration, please use this BOM.
+
+You can use it in your code by adding the following as a dependency:
+
+```xml
+<dependency>
+    <groupId>org.apache.opennlp</groupId>
+    <artifactId>opennlp-dl-gpu</artifactId>
+    <version>${opennlp.version}</version>
+ </dependency>
+```
\ No newline at end of file
diff --git a/opennlp-dl/pom.xml b/opennlp-dl-gpu/pom.xml
similarity index 55%
copy from opennlp-dl/pom.xml
copy to opennlp-dl-gpu/pom.xml
index 4f6f37c8..6310049f 100644
--- a/opennlp-dl/pom.xml
+++ b/opennlp-dl-gpu/pom.xml
@@ -28,28 +28,26 @@
     <relativePath>../pom.xml</relativePath>
   </parent>
   <groupId>org.apache.opennlp</groupId>
-  <artifactId>opennlp-dl</artifactId>
-  <name>Apache OpenNLP DL</name>
+  <artifactId>opennlp-dl-gpu</artifactId>
+  <name>Apache OpenNLP DL (GPU)</name>
+
   <dependencies>
     <dependency>
       <groupId>org.apache.opennlp</groupId>
-      <artifactId>opennlp-tools</artifactId>
+      <artifactId>opennlp-dl</artifactId>
       <version>${project.version}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>com.microsoft.onnxruntime</groupId>
+          <artifactId>onnxruntime</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
       <groupId>com.microsoft.onnxruntime</groupId>
-      <artifactId>onnxruntime</artifactId>
+      <artifactId>onnxruntime_gpu</artifactId>
       <version>${onnxruntime.version}</version>
     </dependency>
-    <dependency>
-      <groupId>com.fasterxml.jackson.core</groupId>
-      <artifactId>jackson-databind</artifactId>
-      <version>${jackson.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.junit.jupiter</groupId>
       <artifactId>junit-jupiter-api</artifactId>
@@ -65,5 +63,53 @@
       <artifactId>slf4j-simple</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.opennlp</groupId>
+      <artifactId>opennlp-dl</artifactId>
+      <version>${project.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <dependenciesToScan>
+            <dependency>org.apache.opennlp:opennlp-dl</dependency>
+          </dependenciesToScan>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>eval-tests</id>
+      <properties>
+        <opennlp.forkCount>0.5C</opennlp.forkCount>
+      </properties>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <argLine>-Xmx4g</argLine>
+              <includes>
+                <include>**/*Test.java</include>
+                <include>**/*Eval.java</include>
+              </includes>
+              <dependenciesToScan>
+                <dependency>org.apache.opennlp:opennlp-dl</dependency>
+              </dependenciesToScan>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
 </project>
diff --git a/opennlp-dl/pom.xml b/opennlp-dl/pom.xml
index 4f6f37c8..ac044dab 100644
--- a/opennlp-dl/pom.xml
+++ b/opennlp-dl/pom.xml
@@ -66,4 +66,21 @@
       <scope>test</scope>
     </dependency>
   </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
 </project>
diff --git a/pom.xml b/pom.xml
index fded2256..706d437e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -561,6 +561,7 @@
 		<module>opennlp-docs</module>
 		<module>opennlp-distr</module>
 		<module>opennlp-dl</module>
+		<module>opennlp-dl-gpu</module>
   </modules>
 
 </project>