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/29 07:38:33 UTC
(opennlp) branch main updated: OPENNLP-1516 - Provide a ONNX runtime GPU module for opennlp-dl (#558)
This is an automated email from the ASF dual-hosted git repository.
rzo1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opennlp.git
The following commit(s) were added to refs/heads/main by this push:
new d5e0d369 OPENNLP-1516 - Provide a ONNX runtime GPU module for opennlp-dl (#558)
d5e0d369 is described below
commit d5e0d3691f2d1dbe946b8633f61702d83bdb3379
Author: Richard Zowalla <13...@users.noreply.github.com>
AuthorDate: Wed Nov 29 08:38:28 2023 +0100
OPENNLP-1516 - Provide a ONNX runtime GPU module for opennlp-dl (#558)
* OPENNLP-1516 - Provide a ONNX runtime module for opennlp-dl
---
README.md | 4 +-
opennlp-dl-gpu/README.md | 13 ++++++
{opennlp-dl => opennlp-dl-gpu}/pom.xml | 72 ++++++++++++++++++++++++++++------
opennlp-dl/pom.xml | 17 ++++++++
pom.xml | 1 +
5 files changed, 93 insertions(+), 14 deletions(-)
diff --git a/README.md b/README.md
index 5826ef8b..244f6614 100644
--- a/README.md
+++ b/README.md
@@ -58,12 +58,14 @@ You can also follow our [mailing lists](http://opennlp.apache.org/mailing-lists.
## Overview
-Currently the library has different packages:
+Currently, the library has different packages:
* `opennlp-tools` : The core toolkit.
* `opennlp-uima` : A set of [Apache UIMA](https://uima.apache.org) annotators.
* `opennlp-brat-annotator` : A set of annotators for [BRAT](http://brat.nlplab.org/)
* `opennlp-morfologik-addon` : An addon for Morfologik
+* `opennlp-dl` : OpenNLP interface implementations for ONNX models using the `onnxruntime` dependency.
+* `opennlp-dl-gpu` : Replaces `onnxruntime` with the `onnxruntime_gpu` dependency to support GPU acceleration.
* `opennlp-sandbox`: Other projects in progress are found in the [sandbox](https://github.com/apache/opennlp-sandbox)
## Getting Started
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>