-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error importing a keras model: Unknown layer: Dot #218
Comments
I am able to reproduce this issue. Looking into it. |
Thanks. If necessary, I also dropped the .h5 file at http://huguesg.fr/incidents/onehot29model.h5 |
The issue seems to be related to missing bytes in the weights files. Now, the mystery is why the weights file is fewer bytes than we expect! My next step is to look at the .h5 file to see if it's contains any clues. |
h5py seems to indicate that the weights are the correct sizes. I then tried converting locally, and it seems to have created a group1 file with the correct size. Can you try making sure your converter is up to date (pip install) and running again on your .h5 file?
|
I updated tensorflowjs (which I installed yesterday, but then updated keras
before outputing these files).
I know have the right size for the files, but a new error is now occuring :
Uncaught (in promise) RangeError: byte length of Float32Array should be a
multiple of 4
The new files are at the same adress : http://huguesg.fr/incidents/
2018-04-23 23:01 GMT+02:00 Stanley Bileschi <notifications@github.com>:
… h5py seems to indicate that the weights are the correct sizes.
I then tried converting locally, and it seems to have created a group1
file with the correct size. Can you try making sure your converter is up to
date (pip install) and running again on your .h5 file?
$ tensorflowjs_converter --input_format keras ./onehot29model.h5 .
...
$ \ls -al
total 832
drwxr-xr-x 7 bileschi eng 224 Apr 23 16:57 .
drwxr-xr-x+ 48 bileschi eng 1536 Apr 23 16:55 ..
-rw-r--r-- 1 bileschi eng 7280 Apr 23 16:57 group1-shard1of1
-rw-r--r-- 1 bileschi eng 6464 Apr 23 16:57 group2-shard1of1
-rw-r--r-- 1 bileschi eng 82944 Apr 23 16:57 group3-shard1of1
-rw-r--r-- 1 bileschi eng 3232 Apr 23 16:57 model.json
-rw-r--r--@ 1 bileschi eng 318256 Apr 23 16:56 onehot29model.h5
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#218 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APNdtyfx_hh2KYGye9nvB0crnJkWWi6Eks5trkFHgaJpZM4Tfvdj>
.
|
I do have similar issue. After importing when I run the code it says
|
I did try updating tfjs to version 0.10.2. I do seem to get the following error now. It would be really helpful if anyone can solve this. It is driving me nuts
|
This is the model I have been trying to convert https://github.com/priya-dwivedi/Deep-Learning/blob/master/qa_chat_bot/model6.h5 |
Hi @Rafi993 , regarding the "No backend found in registry." error - there was a problem with 0.10.2. We just released 0.10.3 and that problem should (hopefully) go away. |
thanks @dsmilkov but after updating to 0.10.3 I have the error
This was the trained model https://gist.github.com/Rafi993/aff598b4c06a4a70a4893f4ee62c25f4#file-trained-model-L140 . the error was in Line 140 "class_name" with value "Dot" |
Still have the same error here with 0.10.3 :
tfjs@0.10.3:1 Uncaught (in promise) RangeError: byte length of Float32Array
should be a multiple of 4
at typedArrayConstructByArrayBuffer (<anonymous>)
at new Float32Array (native)
at https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@0.10.3:1:312391
at Array.forEach (<anonymous>)
at https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@0.10.3:1:312275
at Array.forEach (<anonymous>)
at Object.<anonymous> (
https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@0.10.3:1:312063)
at r (https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@0.10.3:1:310574)
at Object.next (
https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@0.10.3:1:309909)
at o (https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@0.10.3:1:309651)
2018-04-24 5:43 GMT+02:00 Rafi <notifications@github.com>:
… thanks @dsmilkov <https://github.com/dsmilkov> but now I have the error
Uncaught (in promise) Error: Unknown layer: Dot
at new t ***@***.***:1)
at Object.n.deserializeKerasObject ***@***.***:1)
at Object.n.deserialize ***@***.***:1)
at p ***@***.***:1)
at t.fromConfig ***@***.***:1)
at Object.n.deserializeKerasObject ***@***.***:1)
at Object.n.deserialize ***@***.***:1)
at ***@***.***:1
at r ***@***.***:1)
at Object.next ***@***.***:1)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#218 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APNdt1XwYE8wnOXVSOWPhVQM9sKcVqZYks5trp96gaJpZM4Tfvdj>
.
|
I was able to load the model using 0.10.3. Can you report the size of the weight shards created by converter? Can you also make sure that your browser is not caching older, incorrect values of the weights? The sizes converter created here are:
You can force reloading of the cached elements in chrome with ctl + shift + r . |
I do have exactly the same size, and tried reloading as advised, but still
get the same error.
Have you tried with the files on http://huguesg.fr/incidents/ ?
2018-04-24 16:31 GMT+02:00 Stanley Bileschi <notifications@github.com>:
… I was able to load the model using 0.10.3.
Can you report the size of the weight shards created by converter? Can you
also make sure that your browser is not caching older, incorrect values of
the weights?
The sizes converter created here are:
-rw-r--r-- 1 bileschi primarygroup 7280 Apr 24 10:13 group1-shard1of1
-rw-r--r-- 1 bileschi primarygroup 6464 Apr 24 10:13 group2-shard1of1
-rw-r--r-- 1 bileschi primarygroup 82944 Apr 24 10:13 group3-shard1of1
You can force reloading of the cached elements in chrome with ctl + shift
+ r .
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#218 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APNdt1kRw430zPwtpKkIDI4sHgw8WPoLks5trzcwgaJpZM4Tfvdj>
.
|
Began working on this. Will send a PR soon. |
FEATURE Fixes tensorflow/tfjs#218
Same problem?How to solve it? o @ io_utils.ts:116 |
Also running into this issue when running
Any help would be much appreciated. |
I don't think the issue that @YajJackson and @freekoy is running into is related to the Dot layer. The issue is being tracked in #924 Closing this PR again. |
https://github.com/tensorflow/tfjs-node/network/alert/yarn.lock/lodash/open <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/tensorflow/tfjs-node/218) <!-- Reviewable:end -->
* 0.3.x: Update the publish-npm script to allow publishing from the release branch. (#203) DEV * Upgrade 0.3.x to 0.15.3 (#210) <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/tensorflow/tfjs-node/210) <!-- Reviewable:end --> * Fix win GPU packaging. (#208) (#211) Turns out that the windows GPU builds for TensorFlow 1.12 lack the directory structure and eager headers. A bug has been filed with core TF - but we should bake in some fixes for this. This PR simply refactors the downloading logic to a new file. I'd like to use this logic in the node-gles package as well (maybe worth releasing as a stand-alone package in the future). After the refactoring, I check the directory structure in Windows. If the folder structure is missing, but the required tensorflow.dll exists - I re-create the directory structure, move and download the proper header files. The screenshot below shows the contents of TF 1.12 Windows GPU: ![capture](https://user-images.githubusercontent.com/306276/53048799-719f4b80-344a-11e9-9004-3eef2446a246.PNG) <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/tensorflow/tfjs-node/208) <!-- Reviewable:end --> * Bump 0.3.1 * Add TensorBoard callback for model training: tf.node.tensorBoard() (#202) (#213) FEATURE See example screenshot: ![image](https://user-images.githubusercontent.com/16824702/52491877-19d52a80-2b96-11e9-8c24-5a403c2450d3.png) Fixes #686 * [0.3.x] Upgrade nyc package fo fix lodash security issue. (#218) (#219) Bump for 0.3.x so we can get a security release spun. https://github.com/tensorflow/tfjs-node/network/alert/yarn.lock/lodash/open <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/tensorflow/tfjs-node/219) <!-- Reviewable:end --> * Bump to 0.3.2 * Upgrade TS libraries and change binding from typings file to plain TypeScript definition. * Upgrade TS dependencies * save * Fix deps-stage * save * Revert TS changes and keep binary staging fixes.
* 0.3.x: Update the publish-npm script to allow publishing from the release branch. (#203) DEV * Upgrade 0.3.x to 0.15.3 (#210) <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/tensorflow/tfjs-node/210) <!-- Reviewable:end --> * Fix win GPU packaging. (#208) (#211) Turns out that the windows GPU builds for TensorFlow 1.12 lack the directory structure and eager headers. A bug has been filed with core TF - but we should bake in some fixes for this. This PR simply refactors the downloading logic to a new file. I'd like to use this logic in the node-gles package as well (maybe worth releasing as a stand-alone package in the future). After the refactoring, I check the directory structure in Windows. If the folder structure is missing, but the required tensorflow.dll exists - I re-create the directory structure, move and download the proper header files. The screenshot below shows the contents of TF 1.12 Windows GPU: ![capture](https://user-images.githubusercontent.com/306276/53048799-719f4b80-344a-11e9-9004-3eef2446a246.PNG) <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/tensorflow/tfjs-node/208) <!-- Reviewable:end --> * Bump 0.3.1 * Add TensorBoard callback for model training: tf.node.tensorBoard() (#202) (#213) FEATURE See example screenshot: ![image](https://user-images.githubusercontent.com/16824702/52491877-19d52a80-2b96-11e9-8c24-5a403c2450d3.png) Fixes #686 * [0.3.x] Upgrade nyc package fo fix lodash security issue. (#218) (#219) Bump for 0.3.x so we can get a security release spun. https://github.com/tensorflow/tfjs-node/network/alert/yarn.lock/lodash/open <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/tensorflow/tfjs-node/219) <!-- Reviewable:end --> * Bump to 0.3.2 * Upgrade TS libraries and change binding from typings file to plain TypeScript definition. * Upgrade TS dependencies * save * Fix deps-stage * save * Revert TS changes and keep binary staging fixes. * Don't use a definition file for the bindings. This causes many issues and doesn't help with redistribution. It looks like exporting a local definition file on top of what else is exported is not a common supported TypeScript use case. This fix simply moves defnitions into a normal TypeScript file. This should fix: #1092 * save * Add typescript integration project. * save * Add license
0.9.0, (and also 0.8.0)
Firefox & Chrome
I tried implementing the 'How to import a Keras Model into TensorFlow.js' tutorial, but could not manage to import my model, and got an: 'Uncaught (in promise) Error: Constructing tensor of shape (28) should match the length of values (22)' which I cannot make sense of. In particular, 28 is the actual number of output units of my model, but I really do not understand where that 22 comes from.
The test page is at: http://huguesg.fr/incidents/test.html
The model.json file is: http://huguesg.fr/incidents/model.json and the 3 shards are also in the same folder.
I tried creating the files both with the tfjs.converters.save_keras_model function or the tensorflowjs_converter function after saving the model as .h5, but neither worked.
The text was updated successfully, but these errors were encountered: