Repository: deepjavalibrary/djl
Pull request #3191 (2024-05-14 16:57:07)

[ci] Fixes build on macOS aarch64 machine
## Description ##

Brief description of what this PR is about

- If this change is a backward incompatible change, why must this change be made?
- Interesting edge cases to note here



Patch:
diff --git a/extensions/tokenizers/src/main/python/djl_converter/arg_parser.py b/extensions/tokenizers/src/main/python/djl_converter/arg_parser.py
index ebc97b979..37df510a4 100644
--- a/extensions/tokenizers/src/main/python/djl_converter/arg_parser.py
+++ b/extensions/tokenizers/src/main/python/djl_converter/arg_parser.py
@@ -53,9 +53,6 @@ def converter_args():
     if args.output_dir is None:
         args.output_dir = "."
 
-    if not os.path.exists(args.output_dir):
-        raise ValueError(f"Invalid output directory: {args.output_dir}.")
-
     return args
 
 
diff --git a/extensions/tokenizers/src/main/python/djl_converter/huggingface_models.py b/extensions/tokenizers/src/main/python/djl_converter/huggingface_models.py
index e856871d1..931aea5b6 100644
--- a/extensions/tokenizers/src/main/python/djl_converter/huggingface_models.py
+++ b/extensions/tokenizers/src/main/python/djl_converter/huggingface_models.py
@@ -32,6 +32,7 @@ ARCHITECTURES_2_TASK = {
     "ForSequenceClassification": "text-classification",
     "ForMultipleChoice": "text-classification",
     "ForMaskedLM": "fill-mask",
+    "BertModel": "sentence-similarity",
 }
 SUPPORTED_TASKS = {
     "fill-mask": FillMaskConverter(),
diff --git a/integration/build.gradle b/integration/build.gradle
index 5417aa36a..f7003fb9f 100644
--- a/integration/build.gradle
+++ b/integration/build.gradle
@@ -10,7 +10,10 @@ dependencies {
     implementation project(":model-zoo")
     implementation project(":testing")
 
-    runtimeOnly project(":engines:mxnet:mxnet-model-zoo")
+    // Don't use MXNet for aarch64
+    if (System.properties['os.arch'] != "aarch64") {
+        runtimeOnly project(":engines:mxnet:mxnet-model-zoo")
+    }
     runtimeOnly project(":engines:pytorch:pytorch-model-zoo")
     runtimeOnly project(":engines:pytorch:pytorch-jni")
     runtimeOnly project(":engines:tensorflow:tensorflow-model-zoo")


Test patch:
diff --git a/examples/src/test/java/ai/djl/examples/inference/TimeSeriesTest.java b/examples/src/test/java/ai/djl/examples/inference/TimeSeriesTest.java
index cd37ef957..614a43560 100644
--- a/examples/src/test/java/ai/djl/examples/inference/TimeSeriesTest.java
+++ b/examples/src/test/java/ai/djl/examples/inference/TimeSeriesTest.java
@@ -55,7 +55,7 @@ public class TimeSeriesTest {
 
     @Test
     public void testAirPassenger() throws ModelException, TranslateException, IOException {
-        TestRequirements.engine("MXNet");
+        TestRequirements.linux();
 
         float[] result = AirPassengersDeepAR.predict();
         logger.info("{}", result);
diff --git a/examples/src/test/java/ai/djl/examples/training/TrainResNetTest.java b/examples/src/test/java/ai/djl/examples/training/TrainResNetTest.java
index b55bc78f9..f33be26de 100644
--- a/examples/src/test/java/ai/djl/examples/training/TrainResNetTest.java
+++ b/examples/src/test/java/ai/djl/examples/training/TrainResNetTest.java
@@ -44,7 +44,7 @@ public class TrainResNetTest {
     @Test
     public void testTrainResNetSymbolicNightly()
             throws ModelException, IOException, TranslateException {
-        TestRequirements.engine("MXNet");
+        TestRequirements.linux();
         TestRequirements.nightly();
         TestRequirements.gpu("MXNet");
 
@@ -65,6 +65,7 @@ public class TrainResNetTest {
     @Test
     public void testTrainResNetImperativeNightly()
             throws ModelException, IOException, TranslateException {
+        TestRequirements.linux();
         TestRequirements.nightly();
         TestRequirements.gpu("MXNet");