Git Product home page Git Product logo

Comments (6)

JonathanSum avatar JonathanSum commented on July 23, 2024 1

I guess the issue happened because I changed the 360 to 512 in below:

"pack": {
    "type": "tensor_from_string",
    "tokenizer": "bert",
    "string": "$text",
    "model_input_length": 512
},
"unpack": {
    "type": "bert_decode_qa_answer",
    "key": "answer"
}

}

Updated:

I changed it back to 360, and the issue still exists.

from playtorch.

raedle avatar raedle commented on July 23, 2024

@JonathanSum, can you provide information on the device, device OS, and the model that produce this error?

Does this happen just by following the PyTorch Live Question Answering tutorial?

I did a quick test with the Distilbert Q&A model that is used in the Question Answering tutorial (see screenshot).

image

from playtorch.

JonathanSum avatar JonathanSum commented on July 23, 2024

My device is oneplus7 with Android version 11.
OS is window 10. What is your testing device?

On the other hand, it gives a warning:

LOG Running "MyFirstProject" with {"rootTag":1}
WARN Possible Unhandled Promise Rejection (id: 0):
Error: 32 > 26
Error: 32 > 26

I guess 32 and 26 are somekind of gradle version.

I may do more testing with Android Studio. I think the more detailed code is in the Android Studio.

from playtorch.

liuyinglao avatar liuyinglao commented on July 23, 2024

Hi @JonathanSum The model runs well on my device as well. The input and output are exactly the same as @raedle .

And I believe the

Error: 32 > 26

is not referring to gradle version but the output of the models. (otherwise it is likely to throw)

The Q&A models's output is [startIndex, endIndex], and the result is constructed with the

inputTokens.slice(startIndex, endIndex+1)

The error is saying the output startIndex(32) is larger than endIndex(26), so it can't construct a valid answer.

The error seems to be thrown within the model, and we can't do much on the model capability (probably use a try catch block to display something more meaningful...)

from playtorch.

JonathanSum avatar JonathanSum commented on July 23, 2024

@liuyinglao thank you for answering. We all use the same model, so it should have issue. The only one thing I changed was changing the 360 to 512 . The live.json file. I will change it back to 360 and redownload the model to test it again.

If you can, please tell me more on the try and catch, so I can see the error. Is it in the native or the JavaScript side?

22-04-10-14-24-32.mp4

Sometimes it gives me an answer. But the answer is way different than yours. I saw some article that said 512 words in Bert(not distill Bert) requires 1.2 GB ram. I have 2-4 gm free ram. I am not sure.

from playtorch.

liuyinglao avatar liuyinglao commented on July 23, 2024

@JonathanSum Hey Jonathan, thanks for reporting the issue! The ios and android could work differently since the tokenizers are implemented in native codes:
https://github.com/pytorch/live/blob/main/react-native-pytorch-core/android/src/main/java/org/pytorch/rn/core/ml/processing/BertTokenizer.java

https://github.com/pytorch/live/blob/main/react-native-pytorch-core/ios/ML/Processing/BertTokenizer.swift

and the tokenizer is not perfect in the beta version.

We realized that this is not the best practice and has been working on providing a one-time implementation which has better performance than this one -- please keep an eye on an recent release :D

from playtorch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.