Might be related to: https://github.com/tensorflow/tfjs-node/pull/187/
When @tensorflow-models/speech-commands links against lastest tfjs-node: 0.2.3, the following error is seen:
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:23:85 - error TS2694: Namespace '"/usr/local/google/home/cais/tfjs/tfjs-models/speech-commands/node_modules/@tensorflow/tfjs-core/dist/io/router_registry"' has no exported member 'IORouterRegistry'.
23 getLoadHandlers: typeof import("@tensorflow/tfjs-core/dist/io/router_registry").IORouterRegistry.getLoadHandlers;
~~~~node_modules/@tensorflow/tfjs-node/dist/index.d.ts:25:85 - error TS2694: Namespace '"/usr/local/google/home/cais/tfjs/tfjs-models/speech-commands/node_modules/@tensorflow/tfjs-core/dist/io/router_registry"' has no exported member 'IORouterRegistry'.
25 getSaveHandlers: typeof import("@tensorflow/tfjs-core/dist/io/router_registry").IORouterRegistry.getSaveHandlers;
~~~~node_modules/@tensorflow/tfjs-node/dist/index.d.ts:28:88 - error TS2694: Namespace '"/usr/local/google/home/cais/tfjs/tfjs-models/speech-commands/node_modules/@tensorflow/tfjs-core/dist/io/router_registry"' has no exported member 'IORouterRegistry'.
28 registerLoadRouter: typeof import("@tensorflow/tfjs-core/dist/io/router_registry").IORouterRegistry.registerLoadRouter;
~~~~node_modules/@tensorflow/tfjs-node/dist/index.d.ts:29:88 - error TS2694: Namespace '"/usr/local/google/home/cais/tfjs/tfjs-models/speech-commands/node_modules/@tensorflow/tfjs-core/dist/io/router_registry"' has no exported member 'IORouterRegistry'.
29 registerSaveRouter: typeof import("@tensorflow/tfjs-core/dist/io/router_registry").IORouterRegistry.registerSaveRouter;
~~~~src/browser_fft_recognizer_test.ts:1075:28 - error TS7006: Parameter 'epoch' implicitly has an 'any' type.
1075 onEpochEnd: async (epoch, logs) => {
~src/browser_fft_recognizer_test.ts:1075:35 - error TS7006: Parameter 'logs' implicitly has an 'any' type.
1075 onEpochEnd: async (epoch, logs) => {
~~~~src/dataset.ts:342:5 - error TS2322: Type '{ xs: Tensor
; ys: Tensor ; }' is not assignable to type '{ xs: Tensor ; ys?: Tensor ; }'.
Types of property 'ys' are incompatible.
Type 'Tensor' is not assignable to type 'Tensor '.
Type 'Rank' is not assignable to type 'Rank.R2'.342 return tf.tidy(() => {
~~~~~~
343 let xTensors: tf.Tensor3D[] = [];
~~~~~~~~~
...
407 };
~~
408 });
~~~src/types.ts:466:17 - error TS2694: Namespace '"/usr/local/google/home/cais/tfjs/tfjs-models/speech-commands/node_modules/@tensorflow/tfjs/dist/index"' has no exported member 'CustomCallbackConfig'.
466 callback?: tf.CustomCallbackConfig;
~~~~src/types.ts:474:27 - error TS2694: Namespace '"/usr/local/google/home/cais/tfjs/tfjs-models/speech-commands/node_modules/@tensorflow/tfjs/dist/index"' has no exported member 'CustomCallbackConfig'.
474 fineTuningCallback?: tf.CustomCallbackConfig;
package.json:
{
"name": "test",
"version": "0.1.0",
"description": "",
"main": "index.js",
"license": "Apache-2.0",
"private": true,
"engines": {
"node": ">=8.11.0"
},
"dependencies": {
"@tensorflow/tfjs-node": "0.2.3",
"typescript": "2.9.2",
"ts-node": "~7.0.0"
}
}
index.js:
import * as tf from '@tensorflow/tfjs-node';
tf.scalar(10).print();;
When I run:
./node_modules/.bin/ts-node index.ts
I get the the following output successfully:
2019-01-15 11:08:34.715938: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
Tensor
10
(node:227628) Warning: N-API is an experimental feature and could change at any time.
Do you maybe have some broken linked packages?
I am experiencing the same issue:
When I clone the example tfjs-models/speech-commands it compiles fine:
$ git clone [email protected]:tensorflow/tfjs-models.git
$ cd tfjs-models/speech-commands
$ yarn
$ yarn publish-local
but when I try to use speech-commands in a new project, I can't import it:
package.json
{
"name": "test",
"version": "0.0.0",
"description": "test",
"main": "index.ts",
"license": "ISC",
"dependencies": {
"@tensorflow-models/speech-commands": "^0.2.3",
"@tensorflow/tfjs": "^0.14.2"
},
"devDependencies": {
"ts-node": "^7.0.1",
"typescript": "^2.9.2"
},
"scripts": {
"build": "tsc"
}
}
index.ts
import * as tf from '@tensorflow/tfjs';
import * as speechCommands from '@tensorflow-models/speech-commands';
trying to run tsc with the same tsconfig as example, I see:
$ tsc
node_modules/@tensorflow-models/speech-commands/dist/types.d.ts:66:19 - error TS2694: Namespace '"node_modules/@tensorflow/tfjs/dist/index"' has no exported member 'CustomCallbackConfig'.
66 callback?: tf.CustomCallbackConfig;
~~~~~~~~~~~~~~~~~~~~
node_modules/@tensorflow-models/speech-commands/dist/types.d.ts:67:29 - error TS2694: Namespace '"node_modules/@tensorflow/tfjs/dist/index"' has no exported member 'CustomCallbackConfig'.
67 fineTuningCallback?: tf.CustomCallbackConfig;
~~~~~~~~~~~~~~~~~~~~
I searched tfjs and all its imports, but I can't find CustomCallbackConfig anywhere.
I believe its supposed to be exported from tfjs-layers?
@mlshapiro The particular error you are seeing has been fixed at HEAD of speech-commands. Further detail: the CustomCallbackConfig type has been replaced with CustomCallbackArgs.
I'm having the same issue as the original error using 0.2.2 and 0.2.3. Downgrading to 0.2.1 fixes the issue so it's something between 0.2.1 and 0.2.2
0.2.2 had a different error:
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:13:30 - error TS2307: Cannot find module '../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/model_management'.
13 copyModel: typeof import("../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/model_management").copyModel;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:14:31 - error TS2307: Cannot find module '../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/model_management'.
14 listModels: typeof import("../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/model_management").listModels;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:15:30 - error TS2307: Cannot find module '../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/model_management'.
15 moveModel: typeof import("../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/model_management").moveModel;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:16:32 - error TS2307: Cannot find module '../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/model_management'.
16 removeModel: typeof import("../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/model_management").removeModel;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:17:33 - error TS2307: Cannot find module '../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/browser_files'.
17 browserFiles: typeof import("../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/browser_files").browserFiles;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:18:39 - error TS2307: Cannot find module '../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/browser_http'.
18 browserHTTPRequest: typeof import("../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/browser_http").browserHTTPRequest;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:19:44 - error TS2307: Cannot find module '../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/io_utils'.
19 concatenateArrayBuffers: typeof import("../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/io_utils").concatenateArrayBuffers;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:20:34 - error TS2307: Cannot find module '../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/io_utils'.
20 decodeWeights: typeof import("../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/io_utils").decodeWeights;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:21:34 - error TS2307: Cannot find module '../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/io_utils'.
21 encodeWeights: typeof import("../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/io_utils").encodeWeights;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:22:31 - error TS2307: Cannot find module '../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/passthrough'.
22 fromMemory: typeof import("../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/passthrough").fromMemory;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:23:36 - error TS2307: Cannot find module '../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/router_registry'.
23 getLoadHandlers: typeof import("../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/router_registry").IORouterRegistry.getLoadHandlers;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:24:49 - error TS2307: Cannot find module '../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/io_utils'.
24 getModelArtifactsInfoForJSON: typeof import("../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/io_utils").getModelArtifactsInfoForJSON;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:25:36 - error TS2307: Cannot find module '../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/router_registry'.
25 getSaveHandlers: typeof import("../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/router_registry").IORouterRegistry.getSaveHandlers;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:26:33 - error TS2307: Cannot find module '../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/browser_http'.
26 isHTTPScheme: typeof import("../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/browser_http").isHTTPScheme;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:27:32 - error TS2307: Cannot find module '../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/weights_loader'.
27 loadWeights: typeof import("../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/weights_loader").loadWeights;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:28:39 - error TS2307: Cannot find module '../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/router_registry'.
28 registerLoadRouter: typeof import("../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/router_registry").IORouterRegistry.registerLoadRouter;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:29:39 - error TS2307: Cannot find module '../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/router_registry'.
29 registerSaveRouter: typeof import("../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/router_registry").IORouterRegistry.registerSaveRouter;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:30:41 - error TS2307: Cannot find module '../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/weights_loader'.
30 weightsLoaderFactory: typeof import("../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/weights_loader").weightsLoaderFactory;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:31:36 - error TS2307: Cannot find module '../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/passthrough'.
31 withSaveHandler: typeof import("../../../../../Users/kreeger/workspace/tfjs-node/node_modules/@tensorflow/tfjs-core/dist/io/passthrough").withSaveHandler;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hrm that is strange - it has references to my laptop. We'll be spinning a new build here this week or next stay tuned.
Any news on this issue ? I am also getting those IORouter Errors:
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:23:85 - error TS2694: Namespace '"/Users/cpietsch/Documents/tfjs-tsne/node_modules/@tensorflow/tfjs-core/dist/io/router_registry"' has no exported member 'IORouterRegistry'.
23 getLoadHandlers: typeof import("@tensorflow/tfjs-core/dist/io/router_registry").IORouterRegistry.getLoadHandlers;
~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:25:85 - error TS2694: Namespace '"/Users/cpietsch/Documents/tfjs-tsne/node_modules/@tensorflow/tfjs-core/dist/io/router_registry"' has no exported member 'IORouterRegistry'.
25 getSaveHandlers: typeof import("@tensorflow/tfjs-core/dist/io/router_registry").IORouterRegistry.getSaveHandlers;
~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:28:88 - error TS2694: Namespace '"/Users/cpietsch/Documents/tfjs-tsne/node_modules/@tensorflow/tfjs-core/dist/io/router_registry"' has no exported member 'IORouterRegistry'.
28 registerLoadRouter: typeof import("@tensorflow/tfjs-core/dist/io/router_registry").IORouterRegistry.registerLoadRouter;
~~~~~~~~~~~~~~~~
node_modules/@tensorflow/tfjs-node/dist/index.d.ts:29:88 - error TS2694: Namespace '"/Users/cpietsch/Documents/tfjs-tsne/node_modules/@tensorflow/tfjs-core/dist/io/router_registry"' has no exported member 'IORouterRegistry'.
29 registerSaveRouter: typeof import("@tensorflow/tfjs-core/dist/io/router_registry").IORouterRegistry.registerSaveRouter;
~~~~~~~~~~~~~~~~
This will be fixed in the next release, apologies for the breakage!
Thx! Is it already fixed on master and building the package locally would work ?
It's actually a problem from tfjs-core, if you checkout core and run yarn publish-local and then run yarn link-local @tensorflow/tfjs-core from speech commands
A sweet, thx! Actually I am trying currently to make tfjs-tsne to work with tfjs-node. So I would do that from my fork of tfjs-tsne.
I think I got it working with yarn publish-local but the IORouterRegistry is still there.
Just to confirm your info: checkout core, yarn publish-local and yarn link-local @tensorflow/tfjs-core inside tfjs-tsne (not touching tfjs-node)
v0.3.0 fixed the IORouter issue. But now I get a binding error:
yarn build
yarn run v1.13.0
$ tsc --project tsconfig-es5.json && tsc
node_modules/@tensorflow/tfjs-node/dist/nodejs_kernel_backend.d.ts:20:40 - error TS2307: Cannot find module './tfjs_binding'.
20 import { TFEOpAttr, TFJSBinding } from './tfjs_binding';
~~~~~~~~~~~~~~~~
error Command failed with exit code 2.
@cpietsch Seems like a missing type in the published package. If you want a temporary hack that unstuck my tsc, add this to your postinstall:
echo "Running patch for missing tfjs-node types"
TARGET_TFJS_FILE=node_modules/@tensorflow/tfjs-node/dist/tfjs_binding.d.ts
if [ ! -f $TARGET_TFJS_FILE ]; then
echo "export type TFEOpAttr = any; export type TFJSBinding = any;" > $TARGET_TFJS_FILE
else
echo "> TFJS target file already exists: ${TARGET_TFJS_FILE}"
fi
The IORouter problem was fixed, Nick can you look at these build issues?
Can you please try with 0.3.1?
@nkreeger I just tried 0.3.1 with tfjs-models/speech-command, which happens to be experiencing the same problem that @yofreke is experiencing. The error still occurs during build:
node_modules/@tensorflow/tfjs-node/dist/nodejs_kernel_backend.d.ts:20:40 - error TS2307: Cannot find module './tfjs_binding'.
20 import { TFEOpAttr, TFJSBinding } from './tfjs_binding';
~~~~
I looked in my node_modules/@tensorflow/tfjs-node/dist folder and the tfjs_binding file is indeed missing. Can you look into it?
Can you please try with 0.3.1?
tfjs_binding.d.ts is still MIA.
@nkreeger Can you take another look? Thanks!
Most helpful comment
@cpietsch Seems like a missing type in the published package. If you want a temporary hack that unstuck my tsc, add this to your
postinstall: