-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add BuildFromBuffer init variant for Java binding #3152
Comments
Please document this usecase, this is not one we got any report from.
Adding those will impair the ability to perform mmap operation and it does have a very negative impact on the performances. |
There's also a constructor that takes a |
(And doesn't impair performance) |
@lissyx Apps delivered through the app store can only access assets through the AssetManager. These files are not kept individually on the filesystem. They can only be accessed through limited means. See https://developer.android.com/reference/kotlin/android/content/res/AssetManager The "filename" in the docs refers to a virtual, relative path into the "assets" blob. Its not something one can fopen in C. @reuben I think MappedByteBuffer should be fine too. It looks like a MappedByteBuffer can be obtained through an AssetFileDescriptor. In fact I am already doing this for other TFL models.
Note that whatever mechanism is added, it needs to work for everything that currently relies on a system file path, so Scorer and Alphabet would also need to be enhanced. I would recommend looking into what NDK api is available to make this easier; https://developer.android.com/ndk/reference/group/asset |
Thanks, i know that, but you can easily download and place those files in your app storage directory, it works very well.
Yes, you are starting to grasp the issue here, its not that trivial. External scorer we ship is 900MB so we need to be careful there... |
If you are able to assemble a patch set that improves behavior, you are welcome, though. |
Exactly! Making copies is not an option. You too are starting to grasp the issue here, its not that trivial :) |
Don't package it as an asset in the application ? I know it's not the most convenient way to distribute, but for the moment, alternatives, as you said, are much worse. |
@vikramambrose So, do you have experience on that? We're kind of overloaded so it's complicated for us, as of now, to investigate that kind of change, but if you have feedback / patches to share, that's welcome. |
@vikramambrose Can you share feedback on that matter? |
Currently the libdeepspeech java binding only offers DeepSpeech(String modelPath) for initialization, This doesn't work in a production environment where the Android app may not be able to provide a "path". Current TFLite java bindings allow for init from java.io.File and java.nio.ByteBuffer. Please add one of these options.
The text was updated successfully, but these errors were encountered: