Description
System information
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js): Yes, Slightly modified USE npm class.
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 11
- Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: N/A
- TensorFlow.js installed from (npm or script link): 4.10.0
- TensorFlow.js version (use command below): 4.10.0
- Browser version: N/A
- Tensorflow.js Converter Version: v3.18.0
Describe the current behavior
We converted this recently : https://tfhub.dev/google/universal-sentence-encoder-large/5 and got around to hooking it up today. First ran into a StaticRegexReplace issue that I did a temp workaround, but even after that I soon ran into this:
"TypeError: Unknown op 'StringJoin'. File an issue at https://github.com/tensorflow/tfjs/issues so we can add it, or register a custom execution with tf.registerOp()\n" +
' at E:\\Helio\\helio-router-api\\node_modules\\.pnpm\\@tensorflow+tfjs-converter@4.10.0_@tensorflow+tfjs-core@4.10.0\\tfjs-converter\\src\\operations\\operation_executor.ts:114:19\n' +
' at executeOp (E:\\Helio\\helio-router-api\\node_modules\\.pnpm\\@tensorflow+tfjs-converter@4.10.0_@tensorflow+tfjs-core@4.10.0\\tfjs-converter\\src\\operations\\operation_executor.ts:119:8)\n' +
' at _loop_1 (E:\\Helio\\helio-router-api\\node_modules\\.pnpm\\@tensorflow+tfjs-converter@4.10.0_@tensorflow+tfjs-core@4.10.0\\tfjs-converter\\src\\executor\\graph_executor.ts:630:13)\n' +
' at GraphExecutor.processStack (E:\\Helio\\helio-router-api\\node_modules\\.pnpm\\@tensorflow+tfjs-converter@4.10.0_@tensorflow+tfjs-core@4.10.0\\node_modules\\@tensorflow\\tfjs-converter\\dist\\tf-converter.node.js:31365:13)\n' +
' at GraphExecutor.<anonymous> (E:\\Helio\\helio-router-api\\node_modules\\.pnpm\\@tensorflow+tfjs-converter@4.10.0_@tensorflow+tfjs-core@4.10.0\\tfjs-converter\\src\\executor\\graph_executor.ts:576:29)\n' +
' at step (E:\\Helio\\helio-router-api\\node_modules\\.pnpm\\@tensorflow+tfjs-converter@4.10.0_@tensorflow+tfjs-core@4.10.0\\node_modules\\tslib\\tslib.es6.js:102:23)\n' +
' at Object.next (E:\\Helio\\helio-router-api\\node_modules\\.pnpm\\@tensorflow+tfjs-converter@4.10.0_@tensorflow+tfjs-core@4.10.0\\node_modules\\tslib\\tslib.es6.js:83:53)\n' +
' at E:\\Helio\\helio-router-api\\node_modules\\.pnpm\\@tensorflow+tfjs-converter@4.10.0_@tensorflow+tfjs-core@4.10.0\\node_modules\\tslib\\tslib.es6.js:76:71\n' +
' at new Promise (<anonymous>)\n' +
' at __awaiter (E:\\Helio\\helio-router-api\\node_modules\\.pnpm\\@tensorflow+tfjs-converter@4.10.0_@tensorflow+tfjs-core@4.10.0\\node_modules\\tslib\\tslib.es6.js:72:12)'
]
I did a search against the repo and found no case of this function, so have to assume it's a valid missing function/exec.
Describe the expected behavior
tfjs would be able to consume and execute the StringJoin function.
Standalone code to reproduce the issue
Provide a reproducible test case that is the bare minimum necessary to generate
the problem. If possible, please share a link to Colab/CodePen/any notebook.
Modified Universal Sentence Encorder class (from NPM):
async embed(inputs: string[] | string): Promise<tf.Tensor2D> {
if (typeof inputs === "string") {
inputs = [inputs]
}
const encodings = inputs.map((d) => this.tokenizer.encode(d))
const indicesArr = encodings.map((arr, i) => arr.map((d, index) => [i, index]))
let flattenedIndicesArr: Array<[number, number]> = []
for (let i = 0; i < indicesArr.length; i++) {
flattenedIndicesArr = flattenedIndicesArr.concat(indicesArr[i] as Array<[number, number]>)
}
const newInput = tf.tensor1d(inputs, "string")
const modelInputs: ModelInputs2 = { inputs: newInput }
const embeddings = await this.model.executeAsync(modelInputs)
newInput.dispose()
return embeddings as tf.Tensor2D
}
Have a copy of the model here:
https://huggingface.co/heliogroup/tfUniversalSELargeJS
Other info / logs Include any logs or source code that would be helpful to
diagnose the problem. If including tracebacks, please include the full
traceback. Large logs and files should be attached.
"TypeError: Unknown op 'StringJoin'. File an issue at https://github.com/tensorflow/tfjs/issues so we can add it, or register a custom execution with tf.registerOp()\n" +
' at E:\\Helio\\helio-router-api\\node_modules\\.pnpm\\@tensorflow+tfjs-converter@4.10.0_@tensorflow+tfjs-core@4.10.0\\tfjs-converter\\src\\operations\\operation_executor.ts:114:19\n' +
' at executeOp (E:\\Helio\\helio-router-api\\node_modules\\.pnpm\\@tensorflow+tfjs-converter@4.10.0_@tensorflow+tfjs-core@4.10.0\\tfjs-converter\\src\\operations\\operation_executor.ts:119:8)\n' +
' at _loop_1 (E:\\Helio\\helio-router-api\\node_modules\\.pnpm\\@tensorflow+tfjs-converter@4.10.0_@tensorflow+tfjs-core@4.10.0\\tfjs-converter\\src\\executor\\graph_executor.ts:630:13)\n' +
' at GraphExecutor.processStack (E:\\Helio\\helio-router-api\\node_modules\\.pnpm\\@tensorflow+tfjs-converter@4.10.0_@tensorflow+tfjs-core@4.10.0\\node_modules\\@tensorflow\\tfjs-converter\\dist\\tf-converter.node.js:31365:13)\n' +
' at GraphExecutor.<anonymous> (E:\\Helio\\helio-router-api\\node_modules\\.pnpm\\@tensorflow+tfjs-converter@4.10.0_@tensorflow+tfjs-core@4.10.0\\tfjs-converter\\src\\executor\\graph_executor.ts:576:29)\n' +
' at step (E:\\Helio\\helio-router-api\\node_modules\\.pnpm\\@tensorflow+tfjs-converter@4.10.0_@tensorflow+tfjs-core@4.10.0\\node_modules\\tslib\\tslib.es6.js:102:23)\n' +
' at Object.next (E:\\Helio\\helio-router-api\\node_modules\\.pnpm\\@tensorflow+tfjs-converter@4.10.0_@tensorflow+tfjs-core@4.10.0\\node_modules\\tslib\\tslib.es6.js:83:53)\n' +
' at E:\\Helio\\helio-router-api\\node_modules\\.pnpm\\@tensorflow+tfjs-converter@4.10.0_@tensorflow+tfjs-core@4.10.0\\node_modules\\tslib\\tslib.es6.js:76:71\n' +
' at new Promise (<anonymous>)\n' +
' at __awaiter (E:\\Helio\\helio-router-api\\node_modules\\.pnpm\\@tensorflow+tfjs-converter@4.10.0_@tensorflow+tfjs-core@4.10.0\\node_modules\\tslib\\tslib.es6.js:72:12)'
]
Thanks!