You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a bit of an edge case, since most models will have at least one input, but in the case where runModel (specifically the async runner implementation) is called with an empty inputs array, it produces an error:
FAIL src/runnable-model/buffered-run-model-params.spec.ts > BufferedRunModelParams > should copy inputs
TypeError: Cannot convert undefined or null to object
❯ BufferedRunModelParams.copyInputs src/runnable-model/buffered-run-model-params.ts:122:11
120|
121| // Copy from the internal buffer to the a…
122| array.set(this.inputs.view)
| ^
123| }
124|
❯ src/runnable-model/buffered-run-model-params.spec.ts:172:12
FAIL tests/runner.spec.ts > spawnAsyncModelRunner (with mock 'js' model) > should run the model (with empty inputs array)
TypeError: Cannot convert undefined or null to object
❯ runModel dist/index.cjs:103:19
❯ ../../node_modules/.pnpm/[email protected]/node_modules/threads/dist/worker/index.js:109:26
❯ ../../node_modules/.pnpm/[email protected]/node_modules/threads/dist/worker/index.js:8:71
❯ __awaiter ../../node_modules/.pnpm/[email protected]/node_modules/threads/dist/worker/index.js:4:12
❯ runFunction ../../node_modules/.pnpm/[email protected]/node_modules/threads/dist/worker/index.js:106:12
The text was updated successfully, but these errors were encountered:
The fix is to check for an empty (internal) inputs buffer in BufferedRunModelParams and skip the copy if the buffer is empty. This is the same approach we used for the outputIndices buffer.
I will add tests for both RunModelParams implementations as well as for the synchronous and async ModelRunner implementations.
This is a bit of an edge case, since most models will have at least one input, but in the case where
runModel
(specifically the async runner implementation) is called with an empty inputs array, it produces an error:The text was updated successfully, but these errors were encountered: