-
Notifications
You must be signed in to change notification settings - Fork 758
Open
Description
π The feature, motivation and pitch
It is simple, there is no way to read model directly from assets. The assets are files bundled in the Android apps.
The assets are not handled the same way as regular files -- they can be accessed only through assets manager.
Alternatives
As a workaround, the model could be loaded from assets and stored into regular file which is then read by the ExecuTorch
val file = File(context.filesDir, modelName)
context.assets.open(modelAssetsPath).use { inputStream ->
FileOutputStream(file).use { outputStream ->
inputStream.copyTo(outputStream)
}
}
// here we can initialize the model
val model = Module.load(file.absolutePath)Additional context
There is generally two way how it could look like:
- initialization from
ByteArray(Kotlin) /byte[](Java) like in ONNX runtime - directly from the assets using asset path and assets manager as parameters like done in LiteRT/TFLite.
RFC (Optional)
No response
Metadata
Metadata
Assignees
Labels
No labels