Comments (4)
I created an example showing how to implement a multi array label softmax cross entropy loss function at https://github.com/awslabs/djl/blob/master/examples/src/main/java/ai/djl/examples/training/TrainCaptcha.java. Please take a look and let me know if there are any further problems or suggestions.
from djl.
@jSaso
Thanks very much for reaching out to us.
Our currently API already support multiple input/multiple label/multiple output use case.
I agree it's not obvious by just looking at the API. And we don't have examples to show case this usage. We will add examples/document to make it clear.
Here is some quick pointer:
- Loss API uses NDList, NDList is a list of NDArray, not a single NDArray, so it can handle multiple data and labels.
- Batch API uses NDList type for data and labels, it's not NDArray, NDList can take multiple data and multiple labels.
- Translator, when pre-processing and post processing data, you can see its also using NDList, which allows user handle multiple input and outputs.
NDList class not only allows users process NDArray by its order, you can actually use named NDArray, so you don't need worry about the order of the inputs. Here is code that handles multiple inputs: https://github.com/awslabs/djl/blob/master/mxnet/mxnet-model-zoo/src/main/java/ai/djl/mxnet/zoo/nlp/qa/BertQATranslator.java#L53-L62
from djl.
Thanks @frankfliu
I saw that API uses NDList. Thats why I thoot that multi array labels - multi class are supported. This is not the case in current API.
It would be nice to to have this supported - implement softmax loss function which support not just single label array, but multiple labels array.
Currently I don't have time to open PR about this feature, but it would be nice to have that feature in DJL API.
from djl.
@jSaso Could you use the CompositeLoss
to combine multiple SoftmaxCrossEntropyLoss
es together?
from djl.
Related Issues (20)
- ONNX Engine Options Bug, ONNX features cannot be defined,It's a parameter type design problem HOT 4
- [pytorch] UnsatisfiedLinkError on Windows11/Intel HOT 8
- Windows libraries for pytorch-native-cpu are missing for version 2.3.0 from maven central. HOT 1
- ai.djl.nn.transformer IdEmbedding has memory leak. HOT 2
- PaddlePaddle引擎使用paddleocr v4版本的模型识别图像时报错,是还不支持paddleocr的v4模型吗? HOT 2
- TimeSeries API PyTorch Engine support
- TimeSeries API Bugs (frequency, context length, FEAT_DYNAMIC_REAL) HOT 6
- CPU Version of TensorFlow Native Package Incorrectly Includes GPU Dependencies HOT 2
- Can I load a pytorch pretrained model, and use its block to replace one in my network? HOT 1
- MXNet NLP GloVe model causes error "Native resource has been released already" HOT 3
- When there are multiple engines on the classpath, DJL might randomly select a non-optimal one
- TfModel doesn't support `Model#load(InputStream is)` HOT 4
- Memory leak in HF tokenizer when using truncation and optWithOverflowingTokens(false) HOT 1
- TF engine memory not fully released HOT 4
- LSTM .optReturnSequence(false) method missed
- Model conversion process failed when deploying Mixtral 8x22B AWQ with djl-tensorrtllm to Sagemaker HOT 3
- Torchscript is in maintenance mode. Supporting it's replacement HOT 4
- How to serv with 2 model folders? HOT 17
- OFA-Sys Chinese-CLIP Example HOT 1
- Support PyTorch 2.4 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from djl.