Repository: deepjavalibrary/djl
Pull request #1879 (2022-08-09 00:27:10)

[ONNXRuntime] upgrade to 1.12.1
## Description ##

This patch support Apple M1

codecov-commenter: # [Codecov](https://codecov.io/gh/deepjavalibrary/djl/pull/1879?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary) Report
> Merging [#1879](https://codecov.io/gh/deepjavalibrary/djl/pull/1879?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary) (4696737) into [master](https://codecov.io/gh/deepjavalibrary/djl/commit/bb5073f7ffc33f1883621fc1783dbb01e70b418f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary) (bb5073f) will **decrease** coverage by `2.09%`.
> The diff coverage is `66.45%`.

```diff
@@             Coverage Diff              @@
##             master    #1879      +/-   ##
============================================
- Coverage     72.08%   69.99%   -2.10%     
- Complexity     5126     5585     +459     
============================================
  Files           473      530      +57     
  Lines         21970    24624    +2654     
  Branches       2351     2679     +328     
============================================
+ Hits          15838    17236    +1398     
- Misses         4925     6073    +1148     
- Partials       1207     1315     +108     
```


| [Impacted Files](https://codecov.io/gh/deepjavalibrary/djl/pull/1879?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary) | Coverage Δ | |
|---|---|---|
| [api/src/main/java/ai/djl/modality/cv/Image.java](https://codecov.io/gh/deepjavalibrary/djl/pull/1879/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L0ltYWdlLmphdmE=) | `69.23% <ø> (-4.11%)` | :arrow_down: |
| [...rc/main/java/ai/djl/modality/cv/MultiBoxPrior.java](https://codecov.io/gh/deepjavalibrary/djl/pull/1879/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L011bHRpQm94UHJpb3IuamF2YQ==) | `76.00% <ø> (ø)` | |
| [...rc/main/java/ai/djl/modality/cv/output/Joints.java](https://codecov.io/gh/deepjavalibrary/djl/pull/1879/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L291dHB1dC9Kb2ludHMuamF2YQ==) | `71.42% <ø> (ø)` | |
| [.../main/java/ai/djl/modality/cv/output/Landmark.java](https://codecov.io/gh/deepjavalibrary/djl/pull/1879/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L291dHB1dC9MYW5kbWFyay5qYXZh) | `100.00% <ø> (ø)` | |
| [...main/java/ai/djl/modality/cv/output/Rectangle.java](https://codecov.io/gh/deepjavalibrary/djl/pull/1879/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L291dHB1dC9SZWN0YW5nbGUuamF2YQ==) | `72.41% <0.00%> (ø)` | |
| [...i/djl/modality/cv/translator/BigGANTranslator.java](https://codecov.io/gh/deepjavalibrary/djl/pull/1879/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L3RyYW5zbGF0b3IvQmlnR0FOVHJhbnNsYXRvci5qYXZh) | `21.42% <0.00%> (-5.24%)` | :arrow_down: |
| [...odality/cv/translator/BigGANTranslatorFactory.java](https://codecov.io/gh/deepjavalibrary/djl/pull/1879/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L3RyYW5zbGF0b3IvQmlnR0FOVHJhbnNsYXRvckZhY3RvcnkuamF2YQ==) | `33.33% <0.00%> (+8.33%)` | :arrow_up: |
| [...nslator/InstanceSegmentationTranslatorFactory.java](https://codecov.io/gh/deepjavalibrary/djl/pull/1879/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L3RyYW5zbGF0b3IvSW5zdGFuY2VTZWdtZW50YXRpb25UcmFuc2xhdG9yRmFjdG9yeS5qYXZh) | `14.28% <0.00%> (-3.90%)` | :arrow_down: |
| [.../cv/translator/SemanticSegmentationTranslator.java](https://codecov.io/gh/deepjavalibrary/djl/pull/1879/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L3RyYW5zbGF0b3IvU2VtYW50aWNTZWdtZW50YXRpb25UcmFuc2xhdG9yLmphdmE=) | `0.00% <0.00%> (ø)` | |
| [.../cv/translator/StyleTransferTranslatorFactory.java](https://codecov.io/gh/deepjavalibrary/djl/pull/1879/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L3RyYW5zbGF0b3IvU3R5bGVUcmFuc2ZlclRyYW5zbGF0b3JGYWN0b3J5LmphdmE=) | `40.00% <ø> (ø)` | |
| ... and [428 more](https://codecov.io/gh/deepjavalibrary/djl/pull/1879/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary) | |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary)


Patch:
diff --git a/engines/onnxruntime/onnxruntime-engine/README.md b/engines/onnxruntime/onnxruntime-engine/README.md
index 70a346dde..fd4427ca7 100644
--- a/engines/onnxruntime/onnxruntime-engine/README.md
+++ b/engines/onnxruntime/onnxruntime-engine/README.md
@@ -73,7 +73,7 @@ Maven:
 <dependency>
     <groupId>com.microsoft.onnxruntime</groupId>
     <artifactId>onnxruntime_gpu</artifactId>
-    <version>1.12.0</version>
+    <version>1.12.1</version>
     <scope>runtime</scope>
 </dependency>
 ```
@@ -83,7 +83,7 @@ Gradle:
     implementation("ai.djl.onnxruntime:onnxruntime-engine:0.18.0") {
         exclude group: "com.microsoft.onnxruntime", module: "onnxruntime"
     }
-    implementation "com.microsoft.onnxruntime:onnxruntime_gpu:1.12.0"
+    implementation "com.microsoft.onnxruntime:onnxruntime_gpu:1.12.1"
 ```
 
 #### Enable TensorRT execution
diff --git a/gradle.properties b/gradle.properties
index d4c487129..d5cde5a8a 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -18,7 +18,7 @@ tensorflow_version=2.7.0
 tflite_version=2.6.2
 dlr_version=1.6.0
 trt_version=8.4.1
-onnxruntime_version=1.12.0
+onnxruntime_version=1.12.1
 paddlepaddle_version=2.2.2
 sentencepiece_version=0.1.96
 tokenizers_version=0.12.0
diff --git a/tools/gradle/check.gradle b/tools/gradle/check.gradle
index 08e0d945a..f4b457512 100644
--- a/tools/gradle/check.gradle
+++ b/tools/gradle/check.gradle
@@ -1,19 +1,21 @@
-apply plugin: "com.github.spotbugs"
-spotbugs {
-    excludeFilter = file("${rootProject.projectDir}/tools/conf/findbugs-exclude.xml")
-    ignoreFailures = false
-    spotbugsTest.enabled = true
-}
-spotbugsMain {
-    reports {
-        xml.enabled false
-        html.enabled true
+if (JavaVersion.current() < JavaVersion.VERSION_18) {
+    apply plugin: "com.github.spotbugs"
+    spotbugs {
+        excludeFilter = file("${rootProject.projectDir}/tools/conf/findbugs-exclude.xml")
+        ignoreFailures = false
+        spotbugsTest.enabled = true
     }
-}
-spotbugsTest {
-    reports {
-        xml.enabled false
-        html.enabled true
+    spotbugsMain {
+        reports {
+            xml.enabled false
+            html.enabled true
+        }
+    }
+    spotbugsTest {
+        reports {
+            xml.enabled false
+            html.enabled true
+        }
     }
 }
 


Test patch:
diff --git a/extensions/hadoop/src/test/java/ai/djl/hadoop/hdfs/HdfsRepositoryTest.java b/extensions/hadoop/src/test/java/ai/djl/hadoop/hdfs/HdfsRepositoryTest.java
index 4bef642d2..3259f22b7 100644
--- a/extensions/hadoop/src/test/java/ai/djl/hadoop/hdfs/HdfsRepositoryTest.java
+++ b/extensions/hadoop/src/test/java/ai/djl/hadoop/hdfs/HdfsRepositoryTest.java
@@ -126,7 +126,8 @@ public class HdfsRepositoryTest {
 
     private void setFilePermission(Configuration config) {
         try {
-            Process process = Runtime.getRuntime().exec("/bin/sh -c umask");
+            String[] cmd = {"/bin/sh", "-c", "umask"};
+            Process process = Runtime.getRuntime().exec(cmd);
             int rc = process.waitFor();
             if (rc != 0) {
                 return;