Loading saved model

232 views
Skip to first unread message

John S

unread,
Jul 16, 2018, 3:10:45 PM7/16/18
to TensorFlow.js Discussion
Hello

We are Experimenting with tfjs-node and
We are having problems loading a saved model.
I understand that currently the loadFrozenModel from tfjs-converter only supports browser loading and not Node?

How do we go about making a model that Tfjs can load? I.e tf.loadModel()

Our workflow comes from using transfer learning and saving he model to a “Saved_Model” that we later converted to web-model
Is it possible to convert such model or .pb model to a tfjs (josh) model?

John S

unread,
Jul 16, 2018, 3:13:00 PM7/16/18
to TensorFlow.js Discussion
Typo. Meant tfjs(json) model

Nikhil Thorat

unread,
Jul 16, 2018, 3:13:01 PM7/16/18
to swanj...@gmail.com, TensorFlow.js Discussion, Ping Yu, Nick Kreeger
+Ping and Nick.

Theoretically the current flow of SavedModel => TensorFlow.js should work in Node.js, is there something specifically breaking?

We're also going to be working on a way to natively just load a SavedModel and execute it in forward mode like you would in TensorFlow.

--
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+uns...@tensorflow.org.
Visit this group at https://groups.google.com/a/tensorflow.org/group/tfjs/.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/e9130b2f-658b-468d-bee7-0cc28a42d1eb%40tensorflow.org.

John S

unread,
Jul 16, 2018, 3:39:40 PM7/16/18
to TensorFlow.js Discussion, swanj...@gmail.com, pi...@google.com, kre...@google.com
Getting 
UnhandledPromiseRejectionWarning: Error: file://model/tensorflowjs_model.pb not found. TypeError: Only HTTP(S) protocols are supported

Here is the code:

var fetch = require('node-fetch');
global.fetch = fetch;

async function tfmodel(){
const MODEL_URL = '.model/tensorflowjs_model.pb';
const WEIGHTS_URL = './model/weights_manifest.json';

const model = await loadFrozenModel(MODEL_URL, WEIGHTS_URL);
return model;
};

John S

unread,
Jul 16, 2018, 3:41:42 PM7/16/18
to TensorFlow.js Discussion, swanj...@gmail.com, pi...@google.com, kre...@google.com
Or better;:)
const MODEL_URL = 'file://model/tensorflowjs_model.pb';
const WEIGHTS_URL = 'file://model/weights_manifest.json';

Is what I was getting the error with...


Nikhil Thorat

unread,
Jul 16, 2018, 3:46:46 PM7/16/18
to swanj...@gmail.com, TensorFlow.js Discussion, Ping Yu, Nick Kreeger

--
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+uns...@tensorflow.org.
Visit this group at https://groups.google.com/a/tensorflow.org/group/tfjs/.
Reply all
Reply to author
Forward
0 new messages