diff --git a/docs/tensorflow/how_to_import_tensorflow_models_in_DJL.md b/docs/tensorflow/how_to_import_tensorflow_models_in_DJL.md index 428b4699025..c57fd055cbb 100644 --- a/docs/tensorflow/how_to_import_tensorflow_models_in_DJL.md +++ b/docs/tensorflow/how_to_import_tensorflow_models_in_DJL.md @@ -50,7 +50,7 @@ Note that you need to click the download model button to find the actual Google Please refer to these two examples: 1. [Object Detection with TensorFlow](https://github.com/deepjavalibrary/djl/blob/master/examples/src/main/java/ai/djl/examples/inference/cv/ObjectDetection.java) for loading from TensorFlow Hub url. -2. [BERT Classification](https://github.com/deepjavalibrary/djl/blob/master/examples/src/main/java/ai/djl/examples/inference/BertClassification.java) for loading from local downloaded model. +2. [BERT Classification](https://github.com/deepjavalibrary/djl/blob/master/examples/src/main/java/ai/djl/examples/inference/nlp/BertClassification.java) for loading from local downloaded model. ## How to import TensorFlow models that use [TensorFlow Extensions](https://www.tensorflow.org/resources/libraries-extensions) @@ -68,7 +68,7 @@ This is a text encoder from tensorflow hub that uses ops from the TensorFlow Tex - You need to download the library files for the extension so that we can load them for use. [Here](https://github.com/tensorflow/text#install-using-pip) are instructions for downloading TensorFlow text. We'll use version `2.7.0` in this example. - After the library files are downloaded, you are ready to load them for use in DJL. You do this by using TensorFlow Java `TensorFlow.loadLibrary(...)` API before loading the model in DJL. -- We can update the existing [UniversalSentenceEncoder](https://github.com/deepjavalibrary/djl/blob/master/examples/src/main/java/ai/djl/examples/inference/UniversalSentenceEncoder.java) example to use the Multilingual model: +- We can update the existing [UniversalSentenceEncoder](https://github.com/deepjavalibrary/djl/blob/master/examples/src/main/java/ai/djl/examples/inference/nlp/UniversalSentenceEncoder.java) example to use the Multilingual model: ```java // Build Criteria for Multilingual Universal Sentence Encoder from TensorFlow Hub diff --git a/examples/docs/BERT_question_and_answer.md b/examples/docs/BERT_question_and_answer.md index 9c65bb31742..a66ca208441 100644 --- a/examples/docs/BERT_question_and_answer.md +++ b/examples/docs/BERT_question_and_answer.md @@ -2,7 +2,7 @@ In this example, you learn how to use the BERT QA model trained by GluonNLP (Apache MXNet) and PyTorch. You can provide the model with a question and a paragraph containing an answer. The model is then able to find the best answer from the answer paragraph. -You can find the source code in [BertQaInference.java](https://github.com/deepjavalibrary/djl/blob/master/examples/src/main/java/ai/djl/examples/inference/BertQaInference.java). +You can find the source code in [BertQaInference.java](https://github.com/deepjavalibrary/djl/blob/master/examples/src/main/java/ai/djl/examples/inference/nlp/BertQaInference.java). Note that Apache MXNet BERT model has a limitation where the max size of the tokens including the question and the paragraph is 384. @@ -33,5 +33,5 @@ Follow [setup](../../docs/development/setup.md) to configure your development en ```sh cd examples -./gradlew run -Dmain=ai.djl.examples.inference.BertQaInference +./gradlew run -Dmain=ai.djl.examples.inference.nlp.BertQaInference ``` diff --git a/examples/docs/sentiment_analysis.md b/examples/docs/sentiment_analysis.md index c83e2f4c1ef..c18c5cc87a5 100644 --- a/examples/docs/sentiment_analysis.md +++ b/examples/docs/sentiment_analysis.md @@ -2,7 +2,7 @@ In this example, you learn how to use the DistilBERT model trained by HuggingFace using PyTorch. You can provide the model with a question and a paragraph containing an answer. The model is then able to find the best answer from the answer paragraph. -You can find the source code in [SentimentAnalysis.java](https://github.com/deepjavalibrary/djl/blob/master/examples/src/main/java/ai/djl/examples/inference/SentimentAnalysis.java). +You can find the source code in [SentimentAnalysis.java](https://github.com/deepjavalibrary/djl/blob/master/examples/src/main/java/ai/djl/examples/inference/nlp/SentimentAnalysis.java). Example: @@ -29,5 +29,5 @@ Follow [setup](../../docs/development/setup.md) to configure your development en ```sh cd examples -./gradlew run -Dmain=ai.djl.examples.inference.SentimentAnalysis +./gradlew run -Dmain=ai.djl.examples.inference.nlp.SentimentAnalysis ``` diff --git a/examples/src/main/java/ai/djl/examples/inference/BertClassification.java b/examples/src/main/java/ai/djl/examples/inference/nlp/BertClassification.java similarity index 99% rename from examples/src/main/java/ai/djl/examples/inference/BertClassification.java rename to examples/src/main/java/ai/djl/examples/inference/nlp/BertClassification.java index dcea78b2561..fd5788123cd 100644 --- a/examples/src/main/java/ai/djl/examples/inference/BertClassification.java +++ b/examples/src/main/java/ai/djl/examples/inference/nlp/BertClassification.java @@ -10,7 +10,7 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.nlp; import ai.djl.MalformedModelException; import ai.djl.ModelException; diff --git a/examples/src/main/java/ai/djl/examples/inference/BertQaInference.java b/examples/src/main/java/ai/djl/examples/inference/nlp/BertQaInference.java similarity index 89% rename from examples/src/main/java/ai/djl/examples/inference/BertQaInference.java rename to examples/src/main/java/ai/djl/examples/inference/nlp/BertQaInference.java index 9538b7c00bb..6f75ec728db 100644 --- a/examples/src/main/java/ai/djl/examples/inference/BertQaInference.java +++ b/examples/src/main/java/ai/djl/examples/inference/nlp/BertQaInference.java @@ -11,11 +11,10 @@ * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.nlp; -import ai.djl.Application; -import ai.djl.Device; import ai.djl.ModelException; +import ai.djl.huggingface.translator.QuestionAnsweringTranslatorFactory; import ai.djl.inference.Predictor; import ai.djl.modality.nlp.qa.QAInput; import ai.djl.repository.zoo.Criteria; @@ -65,11 +64,11 @@ public static String predict() throws IOException, TranslateException, ModelExce Criteria criteria = Criteria.builder() - .optApplication(Application.NLP.QUESTION_ANSWER) .setTypes(QAInput.class, String.class) - .optFilter("backbone", "bert") + .optModelUrls( + "djl://ai.djl.huggingface.pytorch/deepset/minilm-uncased-squad2") .optEngine("PyTorch") - .optDevice(Device.cpu()) + .optTranslatorFactory(new QuestionAnsweringTranslatorFactory()) .optProgress(new ProgressBar()) .build(); diff --git a/examples/src/main/java/ai/djl/examples/inference/SentimentAnalysis.java b/examples/src/main/java/ai/djl/examples/inference/nlp/SentimentAnalysis.java similarity index 95% rename from examples/src/main/java/ai/djl/examples/inference/SentimentAnalysis.java rename to examples/src/main/java/ai/djl/examples/inference/nlp/SentimentAnalysis.java index 40045f21a95..29671fb5ded 100644 --- a/examples/src/main/java/ai/djl/examples/inference/SentimentAnalysis.java +++ b/examples/src/main/java/ai/djl/examples/inference/nlp/SentimentAnalysis.java @@ -11,9 +11,8 @@ * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.nlp; -import ai.djl.Application; import ai.djl.Device; import ai.djl.MalformedModelException; import ai.djl.ModelException; @@ -58,8 +57,8 @@ public static Classifications predict() Criteria criteria = Criteria.builder() - .optApplication(Application.NLP.SENTIMENT_ANALYSIS) .setTypes(String.class, Classifications.class) + .optModelUrls("djl://ai.djl.pytorch/distilbert") .optEngine("PyTorch") // This model was traced on CPU and can only run on CPU .optDevice(Device.cpu()) diff --git a/examples/src/main/java/ai/djl/examples/inference/UniversalSentenceEncoder.java b/examples/src/main/java/ai/djl/examples/inference/nlp/UniversalSentenceEncoder.java similarity index 99% rename from examples/src/main/java/ai/djl/examples/inference/UniversalSentenceEncoder.java rename to examples/src/main/java/ai/djl/examples/inference/nlp/UniversalSentenceEncoder.java index 4cc299f42bb..ac6c1619ef4 100644 --- a/examples/src/main/java/ai/djl/examples/inference/UniversalSentenceEncoder.java +++ b/examples/src/main/java/ai/djl/examples/inference/nlp/UniversalSentenceEncoder.java @@ -10,7 +10,7 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.nlp; import ai.djl.Application; import ai.djl.MalformedModelException; diff --git a/examples/src/test/java/ai/djl/examples/inference/ActionRecognitionTest.java b/examples/src/test/java/ai/djl/examples/inference/cv/ActionRecognitionTest.java similarity index 92% rename from examples/src/test/java/ai/djl/examples/inference/ActionRecognitionTest.java rename to examples/src/test/java/ai/djl/examples/inference/cv/ActionRecognitionTest.java index 63b9bbc2bc5..cc7253e6b97 100644 --- a/examples/src/test/java/ai/djl/examples/inference/ActionRecognitionTest.java +++ b/examples/src/test/java/ai/djl/examples/inference/cv/ActionRecognitionTest.java @@ -10,10 +10,9 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.cv; import ai.djl.ModelException; -import ai.djl.examples.inference.cv.ActionRecognition; import ai.djl.modality.Classifications; import ai.djl.translate.TranslateException; diff --git a/examples/src/test/java/ai/djl/examples/inference/BigGANTest.java b/examples/src/test/java/ai/djl/examples/inference/cv/BigGANTest.java similarity index 94% rename from examples/src/test/java/ai/djl/examples/inference/BigGANTest.java rename to examples/src/test/java/ai/djl/examples/inference/cv/BigGANTest.java index 8158db0508e..80aebc619c3 100644 --- a/examples/src/test/java/ai/djl/examples/inference/BigGANTest.java +++ b/examples/src/test/java/ai/djl/examples/inference/cv/BigGANTest.java @@ -10,10 +10,9 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.cv; import ai.djl.ModelException; -import ai.djl.examples.inference.cv.BigGAN; import ai.djl.modality.cv.Image; import ai.djl.testing.TestRequirements; import ai.djl.translate.TranslateException; diff --git a/examples/src/test/java/ai/djl/examples/inference/InstanceSegmentationTest.java b/examples/src/test/java/ai/djl/examples/inference/cv/InstanceSegmentationTest.java similarity index 93% rename from examples/src/test/java/ai/djl/examples/inference/InstanceSegmentationTest.java rename to examples/src/test/java/ai/djl/examples/inference/cv/InstanceSegmentationTest.java index e04f0f99b14..193d2fdf267 100644 --- a/examples/src/test/java/ai/djl/examples/inference/InstanceSegmentationTest.java +++ b/examples/src/test/java/ai/djl/examples/inference/cv/InstanceSegmentationTest.java @@ -10,10 +10,9 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.cv; import ai.djl.ModelException; -import ai.djl.examples.inference.cv.InstanceSegmentation; import ai.djl.modality.Classifications; import ai.djl.modality.cv.output.DetectedObjects; import ai.djl.translate.TranslateException; diff --git a/examples/src/test/java/ai/djl/examples/inference/MaskDetectionTest.java b/examples/src/test/java/ai/djl/examples/inference/cv/MaskDetectionTest.java similarity index 95% rename from examples/src/test/java/ai/djl/examples/inference/MaskDetectionTest.java rename to examples/src/test/java/ai/djl/examples/inference/cv/MaskDetectionTest.java index 02ef7f6f804..42da8844ed7 100644 --- a/examples/src/test/java/ai/djl/examples/inference/MaskDetectionTest.java +++ b/examples/src/test/java/ai/djl/examples/inference/cv/MaskDetectionTest.java @@ -10,10 +10,9 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.cv; import ai.djl.ModelException; -import ai.djl.examples.inference.cv.MaskDetection; import ai.djl.modality.Classifications; import ai.djl.modality.cv.output.DetectedObjects; import ai.djl.testing.TestRequirements; diff --git a/examples/src/test/java/ai/djl/examples/inference/ObjectDetectionTest.java b/examples/src/test/java/ai/djl/examples/inference/cv/ObjectDetectionTest.java similarity index 95% rename from examples/src/test/java/ai/djl/examples/inference/ObjectDetectionTest.java rename to examples/src/test/java/ai/djl/examples/inference/cv/ObjectDetectionTest.java index 076fda3f961..e83c4881d26 100644 --- a/examples/src/test/java/ai/djl/examples/inference/ObjectDetectionTest.java +++ b/examples/src/test/java/ai/djl/examples/inference/cv/ObjectDetectionTest.java @@ -10,10 +10,9 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.cv; import ai.djl.ModelException; -import ai.djl.examples.inference.cv.ObjectDetection; import ai.djl.modality.Classifications; import ai.djl.modality.cv.output.DetectedObjects; import ai.djl.testing.TestRequirements; diff --git a/examples/src/test/java/ai/djl/examples/inference/ObjectDetectionWithTensorflowSavedModelTest.java b/examples/src/test/java/ai/djl/examples/inference/cv/ObjectDetectionWithTensorflowSavedModelTest.java similarity index 94% rename from examples/src/test/java/ai/djl/examples/inference/ObjectDetectionWithTensorflowSavedModelTest.java rename to examples/src/test/java/ai/djl/examples/inference/cv/ObjectDetectionWithTensorflowSavedModelTest.java index cb8448113be..91704905d71 100644 --- a/examples/src/test/java/ai/djl/examples/inference/ObjectDetectionWithTensorflowSavedModelTest.java +++ b/examples/src/test/java/ai/djl/examples/inference/cv/ObjectDetectionWithTensorflowSavedModelTest.java @@ -11,10 +11,9 @@ * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.cv; import ai.djl.ModelException; -import ai.djl.examples.inference.cv.ObjectDetectionWithTensorflowSavedModel; import ai.djl.modality.Classifications; import ai.djl.modality.cv.output.DetectedObjects; import ai.djl.testing.TestRequirements; diff --git a/examples/src/test/java/ai/djl/examples/inference/PoseEstimationTest.java b/examples/src/test/java/ai/djl/examples/inference/cv/PoseEstimationTest.java similarity index 92% rename from examples/src/test/java/ai/djl/examples/inference/PoseEstimationTest.java rename to examples/src/test/java/ai/djl/examples/inference/cv/PoseEstimationTest.java index 398c71ced6e..bade178b622 100644 --- a/examples/src/test/java/ai/djl/examples/inference/PoseEstimationTest.java +++ b/examples/src/test/java/ai/djl/examples/inference/cv/PoseEstimationTest.java @@ -10,10 +10,9 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.cv; import ai.djl.ModelException; -import ai.djl.examples.inference.cv.PoseEstimation; import ai.djl.modality.cv.output.Joints; import ai.djl.translate.TranslateException; diff --git a/examples/src/test/java/ai/djl/examples/inference/StyleTransferTest.java b/examples/src/test/java/ai/djl/examples/inference/cv/StyleTransferTest.java similarity index 94% rename from examples/src/test/java/ai/djl/examples/inference/StyleTransferTest.java rename to examples/src/test/java/ai/djl/examples/inference/cv/StyleTransferTest.java index 645a88b57bb..c5159b29895 100644 --- a/examples/src/test/java/ai/djl/examples/inference/StyleTransferTest.java +++ b/examples/src/test/java/ai/djl/examples/inference/cv/StyleTransferTest.java @@ -10,10 +10,9 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.cv; import ai.djl.ModelException; -import ai.djl.examples.inference.cv.StyleTransfer; import ai.djl.modality.cv.Image; import ai.djl.modality.cv.ImageFactory; import ai.djl.testing.TestRequirements; diff --git a/examples/src/test/java/ai/djl/examples/inference/Yolov8DetectionTest.java b/examples/src/test/java/ai/djl/examples/inference/cv/Yolov8DetectionTest.java similarity index 94% rename from examples/src/test/java/ai/djl/examples/inference/Yolov8DetectionTest.java rename to examples/src/test/java/ai/djl/examples/inference/cv/Yolov8DetectionTest.java index de46c8967e0..f34c0a02510 100644 --- a/examples/src/test/java/ai/djl/examples/inference/Yolov8DetectionTest.java +++ b/examples/src/test/java/ai/djl/examples/inference/cv/Yolov8DetectionTest.java @@ -10,10 +10,9 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.cv; import ai.djl.ModelException; -import ai.djl.examples.inference.cv.Yolov8Detection; import ai.djl.modality.Classifications; import ai.djl.modality.cv.output.DetectedObjects; import ai.djl.testing.TestRequirements; diff --git a/examples/src/test/java/ai/djl/examples/inference/cv/package-info.java b/examples/src/test/java/ai/djl/examples/inference/cv/package-info.java new file mode 100644 index 00000000000..c47d4738a31 --- /dev/null +++ b/examples/src/test/java/ai/djl/examples/inference/cv/package-info.java @@ -0,0 +1,15 @@ +/* + * Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance + * with the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +/** Contains tests for the inference examples. */ +package ai.djl.examples.inference.cv; diff --git a/examples/src/test/java/ai/djl/examples/inference/FeatureComparisonTest.java b/examples/src/test/java/ai/djl/examples/inference/face/FeatureComparisonTest.java similarity index 91% rename from examples/src/test/java/ai/djl/examples/inference/FeatureComparisonTest.java rename to examples/src/test/java/ai/djl/examples/inference/face/FeatureComparisonTest.java index 7e355ecfac8..245acdcfa64 100644 --- a/examples/src/test/java/ai/djl/examples/inference/FeatureComparisonTest.java +++ b/examples/src/test/java/ai/djl/examples/inference/face/FeatureComparisonTest.java @@ -10,11 +10,9 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.face; import ai.djl.ModelException; -import ai.djl.examples.inference.face.FeatureComparison; -import ai.djl.examples.inference.face.FeatureExtraction; import ai.djl.modality.cv.Image; import ai.djl.modality.cv.ImageFactory; import ai.djl.testing.TestRequirements; diff --git a/examples/src/test/java/ai/djl/examples/inference/FeatureExtractionTest.java b/examples/src/test/java/ai/djl/examples/inference/face/FeatureExtractionTest.java similarity index 93% rename from examples/src/test/java/ai/djl/examples/inference/FeatureExtractionTest.java rename to examples/src/test/java/ai/djl/examples/inference/face/FeatureExtractionTest.java index c5ac6bd1119..af50b240a0a 100644 --- a/examples/src/test/java/ai/djl/examples/inference/FeatureExtractionTest.java +++ b/examples/src/test/java/ai/djl/examples/inference/face/FeatureExtractionTest.java @@ -10,10 +10,9 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.face; import ai.djl.ModelException; -import ai.djl.examples.inference.face.FeatureExtraction; import ai.djl.modality.cv.Image; import ai.djl.modality.cv.ImageFactory; import ai.djl.testing.TestRequirements; diff --git a/examples/src/test/java/ai/djl/examples/inference/LightFaceDetectionTest.java b/examples/src/test/java/ai/djl/examples/inference/face/LightFaceDetectionTest.java similarity index 94% rename from examples/src/test/java/ai/djl/examples/inference/LightFaceDetectionTest.java rename to examples/src/test/java/ai/djl/examples/inference/face/LightFaceDetectionTest.java index 360a76049f3..b3d28a36c67 100644 --- a/examples/src/test/java/ai/djl/examples/inference/LightFaceDetectionTest.java +++ b/examples/src/test/java/ai/djl/examples/inference/face/LightFaceDetectionTest.java @@ -10,10 +10,9 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.face; import ai.djl.ModelException; -import ai.djl.examples.inference.face.LightFaceDetection; import ai.djl.modality.Classifications; import ai.djl.modality.cv.output.DetectedObjects; import ai.djl.testing.TestRequirements; diff --git a/examples/src/test/java/ai/djl/examples/inference/RetinaFaceDetectionTest.java b/examples/src/test/java/ai/djl/examples/inference/face/RetinaFaceDetectionTest.java similarity index 94% rename from examples/src/test/java/ai/djl/examples/inference/RetinaFaceDetectionTest.java rename to examples/src/test/java/ai/djl/examples/inference/face/RetinaFaceDetectionTest.java index 0060cd3e67d..39e9737cede 100644 --- a/examples/src/test/java/ai/djl/examples/inference/RetinaFaceDetectionTest.java +++ b/examples/src/test/java/ai/djl/examples/inference/face/RetinaFaceDetectionTest.java @@ -10,10 +10,9 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.face; import ai.djl.ModelException; -import ai.djl.examples.inference.face.RetinaFaceDetection; import ai.djl.modality.Classifications; import ai.djl.modality.cv.output.DetectedObjects; import ai.djl.testing.TestRequirements; diff --git a/examples/src/test/java/ai/djl/examples/inference/face/package-info.java b/examples/src/test/java/ai/djl/examples/inference/face/package-info.java new file mode 100644 index 00000000000..881e4fd933a --- /dev/null +++ b/examples/src/test/java/ai/djl/examples/inference/face/package-info.java @@ -0,0 +1,15 @@ +/* + * Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance + * with the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +/** Contains tests for the inference examples. */ +package ai.djl.examples.inference.face; diff --git a/examples/src/test/java/ai/djl/examples/inference/BertQaTest.java b/examples/src/test/java/ai/djl/examples/inference/nlp/BertQaTest.java similarity index 96% rename from examples/src/test/java/ai/djl/examples/inference/BertQaTest.java rename to examples/src/test/java/ai/djl/examples/inference/nlp/BertQaTest.java index 06194ac513e..21a70ff6756 100644 --- a/examples/src/test/java/ai/djl/examples/inference/BertQaTest.java +++ b/examples/src/test/java/ai/djl/examples/inference/nlp/BertQaTest.java @@ -10,7 +10,7 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.nlp; import ai.djl.ModelException; import ai.djl.testing.TestRequirements; diff --git a/examples/src/test/java/ai/djl/examples/inference/SentimentAnalysisTest.java b/examples/src/test/java/ai/djl/examples/inference/nlp/SentimentAnalysisTest.java similarity index 96% rename from examples/src/test/java/ai/djl/examples/inference/SentimentAnalysisTest.java rename to examples/src/test/java/ai/djl/examples/inference/nlp/SentimentAnalysisTest.java index 4091c91525e..c18b1f296ed 100644 --- a/examples/src/test/java/ai/djl/examples/inference/SentimentAnalysisTest.java +++ b/examples/src/test/java/ai/djl/examples/inference/nlp/SentimentAnalysisTest.java @@ -10,7 +10,7 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.nlp; import ai.djl.ModelException; import ai.djl.modality.Classifications; diff --git a/examples/src/test/java/ai/djl/examples/inference/UniversalSentenceEncoderTest.java b/examples/src/test/java/ai/djl/examples/inference/nlp/UniversalSentenceEncoderTest.java similarity index 97% rename from examples/src/test/java/ai/djl/examples/inference/UniversalSentenceEncoderTest.java rename to examples/src/test/java/ai/djl/examples/inference/nlp/UniversalSentenceEncoderTest.java index a85564fb67b..fb9551be188 100644 --- a/examples/src/test/java/ai/djl/examples/inference/UniversalSentenceEncoderTest.java +++ b/examples/src/test/java/ai/djl/examples/inference/nlp/UniversalSentenceEncoderTest.java @@ -10,7 +10,7 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.nlp; import ai.djl.ModelException; import ai.djl.testing.TestRequirements; diff --git a/examples/src/test/java/ai/djl/examples/inference/SuperResolutionTest.java b/examples/src/test/java/ai/djl/examples/inference/sr/SuperResolutionTest.java similarity index 95% rename from examples/src/test/java/ai/djl/examples/inference/SuperResolutionTest.java rename to examples/src/test/java/ai/djl/examples/inference/sr/SuperResolutionTest.java index e40c2e6ade3..4895c8d74f3 100644 --- a/examples/src/test/java/ai/djl/examples/inference/SuperResolutionTest.java +++ b/examples/src/test/java/ai/djl/examples/inference/sr/SuperResolutionTest.java @@ -10,10 +10,9 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.sr; import ai.djl.ModelException; -import ai.djl.examples.inference.sr.SuperResolution; import ai.djl.modality.cv.Image; import ai.djl.modality.cv.ImageFactory; import ai.djl.testing.TestRequirements; diff --git a/examples/src/test/java/ai/djl/examples/inference/sr/package-info.java b/examples/src/test/java/ai/djl/examples/inference/sr/package-info.java new file mode 100644 index 00000000000..60033daa215 --- /dev/null +++ b/examples/src/test/java/ai/djl/examples/inference/sr/package-info.java @@ -0,0 +1,15 @@ +/* + * Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance + * with the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +/** Contains tests for the inference examples. */ +package ai.djl.examples.inference.sr; diff --git a/examples/src/test/java/ai/djl/examples/inference/TimeSeriesTest.java b/examples/src/test/java/ai/djl/examples/inference/timeseries/TimeSeriesTest.java similarity index 92% rename from examples/src/test/java/ai/djl/examples/inference/TimeSeriesTest.java rename to examples/src/test/java/ai/djl/examples/inference/timeseries/TimeSeriesTest.java index 614a43560bb..ee6fce700ca 100644 --- a/examples/src/test/java/ai/djl/examples/inference/TimeSeriesTest.java +++ b/examples/src/test/java/ai/djl/examples/inference/timeseries/TimeSeriesTest.java @@ -11,11 +11,9 @@ * and limitations under the License. */ -package ai.djl.examples.inference; +package ai.djl.examples.inference.timeseries; import ai.djl.ModelException; -import ai.djl.examples.inference.timeseries.AirPassengersDeepAR; -import ai.djl.examples.inference.timeseries.M5ForecastingDeepAR; import ai.djl.testing.TestRequirements; import ai.djl.translate.TranslateException; diff --git a/examples/src/test/java/ai/djl/examples/inference/timeseries/package-info.java b/examples/src/test/java/ai/djl/examples/inference/timeseries/package-info.java new file mode 100644 index 00000000000..8d8fd25e29e --- /dev/null +++ b/examples/src/test/java/ai/djl/examples/inference/timeseries/package-info.java @@ -0,0 +1,15 @@ +/* + * Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance + * with the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +/** Contains tests for the inference examples. */ +package ai.djl.examples.inference.timeseries;