Commit f43d3c5
authored
fix: expose unload() JSI binding for TextToImageModule (#947)
## Summary
`TextToImage::unload()` is implemented in C++ and correctly delegates to
its sub-components (encoder, unet, decoder), but the JSI binding was
never registered in `ModelHostObject`. This causes a `TypeError:
this.nativeModule.unload is not a function` when calling
`BaseModule.delete()` from JavaScript.
Every other composite model (OCR, VerticalOCR, Kokoro, LLM) already
registers `unload` in its `if constexpr` block — this adds the same
one-liner for TextToImage.
## Changes
- Added `unload` JSI export to the `TextToImage` block in
`ModelHostObject.h`, matching the existing pattern used by other models
## Test plan
- [x] Call `module.delete()` on a loaded `TextToImageModule` — should no
longer throw
- [x] Verify model memory is released after `delete()` (encoder, unet,
decoder sub-models are unloaded)1 parent fdbd3e9 commit f43d3c5
File tree
1 file changed
+2
-0
lines changed- packages/react-native-executorch/common/rnexecutorch/host_objects
1 file changed
+2
-0
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| 151 | + | |
| 152 | + | |
151 | 153 | | |
152 | 154 | | |
153 | 155 | | |
| |||
0 commit comments