Can tensorflowjs_converter work with Keras models made with functional API?Can I run Keras model on gpu?Keras Visualization of Model Built from Functional APIMerging two models in Keras Functional APIHow to call a multidimensional prediction on a keras model with a javascript apiInconsistency in Keras Sequential model vs Functional APIUnable to save the model made with Keras functional APIIs it possible to train a CNN starting at an intermediate layer (in general and in Keras)?Training a tf.keras model with a basic low-level TensorFlow training loop doesn't workHow can I freeze last layer of my own model?Problem converting Keras Models into Layers API format models to use with tensorflow.js

How can I get rid of an unhelpful parallel branch when unpivoting a single row?

All ASCII characters with a given bit count

Multiple options vs single option UI

Philosophical question on logistic regression: why isn't the optimal threshold value trained?

How do I produce this Greek letter koppa: Ϟ in pdfLaTeX?

How do I deal with a coworker that keeps asking to make small superficial changes to a report, and it is seriously triggering my anxiety?

Why do distances seem to matter in the Foundation world?

Is there metaphorical meaning of "aus der Haft entlassen"?

How can I practically buy stocks?

"The cow" OR "a cow" OR "cows" in this context

How much of a wave function must reside inside event horizon for it to be consumed by the black hole?

Find a stone which is not the lightest one

What is the best way to deal with NPC-NPC combat?

Do I need to watch Ant-Man and the Wasp and Captain Marvel before watching Avengers: Endgame?

Multiple fireplaces in an apartment building?

Can a Bard use the Spell Glyph option of the Glyph of Warding spell and cast a known spell into the glyph?

As an international instructor, should I openly talk about my accent?

How to not starve gigantic beasts

Unknown code in script

A faster way to compute the largest prime factor

Why did C use the -> operator instead of reusing the . operator?

Would the change in enthalpy (ΔH) for the dissolution of urea in water be positive or negative?

"Whatever a Russian does, they end up making the Kalashnikov gun"? Are there any similar proverbs in English?

Is Electric Central Heating worth it if using Solar Panels?



Can tensorflowjs_converter work with Keras models made with functional API?


Can I run Keras model on gpu?Keras Visualization of Model Built from Functional APIMerging two models in Keras Functional APIHow to call a multidimensional prediction on a keras model with a javascript apiInconsistency in Keras Sequential model vs Functional APIUnable to save the model made with Keras functional APIIs it possible to train a CNN starting at an intermediate layer (in general and in Keras)?Training a tf.keras model with a basic low-level TensorFlow training loop doesn't workHow can I freeze last layer of my own model?Problem converting Keras Models into Layers API format models to use with tensorflow.js






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm trying to convert models made with tf.keras in Python to tensorflow.js format for use in Node.js. Here are my package versions:



tensorflowjs: 1.0.1
Keras: 2.2.4
tf-nightly-2.0-preview: 2.0.0.dev20190321 (from pip install tensorflowjs)


Here is my Sequential model also remade with the functional API:



# Sequential API
model = tf.keras.Sequential()
model.add(layers.Dense(128, activation='relu', input_shape=(22050,))
model.add(layers.Dense(9, activation='softmax'))

# Functional API
inputs = tf.keras.Input(shape=(22050,))
x = layers.Dense(128, activation='relu')(inputs)
logits = layers.Dense(9, activation='softmax')(x)


When I convert the Sequential model to tfjs_layers_model using tensorflowjs_converter, it loads fine with tensorflowjs. When I do the same thing with the functional model, I get improperly formatted model config error:



Error: Improperly formatted model config for layer "_callHook":null,"_addedWeightNames":[],"_stateful":false,"id":1,"activityRegularizer":null,"inputSpec":["minNDim":2],"supportsMasking":true,"_trainableWeights":[],"_nonTrainableWeights":[],"_losses":[],"_updates":[],"_built":false,"inboundNodes":[],"outboundNodes":[],"name":"dense_38","trainable_":true,"updatable":true,"initialWeights":null,"_refCount":null,"fastWeightInitDuringBuild":true,"activation":,"useBias":true,"kernel":null,"bias":null,"DEFAULT_KERNEL_INITIALIZER":"glorotNormal","DEFAULT_BIAS_INITIALIZER":"zeros","units":128,"kernelInitializer":"scale":1,"mode":"fanAvg","distribution":"uniform","seed":null,"biasInitializer":,"kernelConstraint":null,"biasConstraint":null,"kernelRegularizer":null,"biasRegularizer":null: "input_26"


I also tried exporting as tfjs_graph_model, but tensorflowjs_converter didn't allow that. I would like the model to eventually have multiple outputs, which is why I'd like to use the functional API rather than Sequential.










share|improve this question
























  • This may be due to a breakage in serialization format that was recently fixed, but may not have made it to nightly yet. Can you check if this works in the latest stable tf release (1.13.1) ?

    – BlessedKey
    Mar 22 at 17:55











  • I uninstalled tf-nightly-2.0-preview and installed tensorflow 1.13.1 but would get errors when importing tensorflowjs. I got ImportError: cannot import name 'convert_to_constants'

    – justinswaney
    Mar 23 at 2:14

















0















I'm trying to convert models made with tf.keras in Python to tensorflow.js format for use in Node.js. Here are my package versions:



tensorflowjs: 1.0.1
Keras: 2.2.4
tf-nightly-2.0-preview: 2.0.0.dev20190321 (from pip install tensorflowjs)


Here is my Sequential model also remade with the functional API:



# Sequential API
model = tf.keras.Sequential()
model.add(layers.Dense(128, activation='relu', input_shape=(22050,))
model.add(layers.Dense(9, activation='softmax'))

# Functional API
inputs = tf.keras.Input(shape=(22050,))
x = layers.Dense(128, activation='relu')(inputs)
logits = layers.Dense(9, activation='softmax')(x)


When I convert the Sequential model to tfjs_layers_model using tensorflowjs_converter, it loads fine with tensorflowjs. When I do the same thing with the functional model, I get improperly formatted model config error:



Error: Improperly formatted model config for layer "_callHook":null,"_addedWeightNames":[],"_stateful":false,"id":1,"activityRegularizer":null,"inputSpec":["minNDim":2],"supportsMasking":true,"_trainableWeights":[],"_nonTrainableWeights":[],"_losses":[],"_updates":[],"_built":false,"inboundNodes":[],"outboundNodes":[],"name":"dense_38","trainable_":true,"updatable":true,"initialWeights":null,"_refCount":null,"fastWeightInitDuringBuild":true,"activation":,"useBias":true,"kernel":null,"bias":null,"DEFAULT_KERNEL_INITIALIZER":"glorotNormal","DEFAULT_BIAS_INITIALIZER":"zeros","units":128,"kernelInitializer":"scale":1,"mode":"fanAvg","distribution":"uniform","seed":null,"biasInitializer":,"kernelConstraint":null,"biasConstraint":null,"kernelRegularizer":null,"biasRegularizer":null: "input_26"


I also tried exporting as tfjs_graph_model, but tensorflowjs_converter didn't allow that. I would like the model to eventually have multiple outputs, which is why I'd like to use the functional API rather than Sequential.










share|improve this question
























  • This may be due to a breakage in serialization format that was recently fixed, but may not have made it to nightly yet. Can you check if this works in the latest stable tf release (1.13.1) ?

    – BlessedKey
    Mar 22 at 17:55











  • I uninstalled tf-nightly-2.0-preview and installed tensorflow 1.13.1 but would get errors when importing tensorflowjs. I got ImportError: cannot import name 'convert_to_constants'

    – justinswaney
    Mar 23 at 2:14













0












0








0








I'm trying to convert models made with tf.keras in Python to tensorflow.js format for use in Node.js. Here are my package versions:



tensorflowjs: 1.0.1
Keras: 2.2.4
tf-nightly-2.0-preview: 2.0.0.dev20190321 (from pip install tensorflowjs)


Here is my Sequential model also remade with the functional API:



# Sequential API
model = tf.keras.Sequential()
model.add(layers.Dense(128, activation='relu', input_shape=(22050,))
model.add(layers.Dense(9, activation='softmax'))

# Functional API
inputs = tf.keras.Input(shape=(22050,))
x = layers.Dense(128, activation='relu')(inputs)
logits = layers.Dense(9, activation='softmax')(x)


When I convert the Sequential model to tfjs_layers_model using tensorflowjs_converter, it loads fine with tensorflowjs. When I do the same thing with the functional model, I get improperly formatted model config error:



Error: Improperly formatted model config for layer "_callHook":null,"_addedWeightNames":[],"_stateful":false,"id":1,"activityRegularizer":null,"inputSpec":["minNDim":2],"supportsMasking":true,"_trainableWeights":[],"_nonTrainableWeights":[],"_losses":[],"_updates":[],"_built":false,"inboundNodes":[],"outboundNodes":[],"name":"dense_38","trainable_":true,"updatable":true,"initialWeights":null,"_refCount":null,"fastWeightInitDuringBuild":true,"activation":,"useBias":true,"kernel":null,"bias":null,"DEFAULT_KERNEL_INITIALIZER":"glorotNormal","DEFAULT_BIAS_INITIALIZER":"zeros","units":128,"kernelInitializer":"scale":1,"mode":"fanAvg","distribution":"uniform","seed":null,"biasInitializer":,"kernelConstraint":null,"biasConstraint":null,"kernelRegularizer":null,"biasRegularizer":null: "input_26"


I also tried exporting as tfjs_graph_model, but tensorflowjs_converter didn't allow that. I would like the model to eventually have multiple outputs, which is why I'd like to use the functional API rather than Sequential.










share|improve this question
















I'm trying to convert models made with tf.keras in Python to tensorflow.js format for use in Node.js. Here are my package versions:



tensorflowjs: 1.0.1
Keras: 2.2.4
tf-nightly-2.0-preview: 2.0.0.dev20190321 (from pip install tensorflowjs)


Here is my Sequential model also remade with the functional API:



# Sequential API
model = tf.keras.Sequential()
model.add(layers.Dense(128, activation='relu', input_shape=(22050,))
model.add(layers.Dense(9, activation='softmax'))

# Functional API
inputs = tf.keras.Input(shape=(22050,))
x = layers.Dense(128, activation='relu')(inputs)
logits = layers.Dense(9, activation='softmax')(x)


When I convert the Sequential model to tfjs_layers_model using tensorflowjs_converter, it loads fine with tensorflowjs. When I do the same thing with the functional model, I get improperly formatted model config error:



Error: Improperly formatted model config for layer "_callHook":null,"_addedWeightNames":[],"_stateful":false,"id":1,"activityRegularizer":null,"inputSpec":["minNDim":2],"supportsMasking":true,"_trainableWeights":[],"_nonTrainableWeights":[],"_losses":[],"_updates":[],"_built":false,"inboundNodes":[],"outboundNodes":[],"name":"dense_38","trainable_":true,"updatable":true,"initialWeights":null,"_refCount":null,"fastWeightInitDuringBuild":true,"activation":,"useBias":true,"kernel":null,"bias":null,"DEFAULT_KERNEL_INITIALIZER":"glorotNormal","DEFAULT_BIAS_INITIALIZER":"zeros","units":128,"kernelInitializer":"scale":1,"mode":"fanAvg","distribution":"uniform","seed":null,"biasInitializer":,"kernelConstraint":null,"biasConstraint":null,"kernelRegularizer":null,"biasRegularizer":null: "input_26"


I also tried exporting as tfjs_graph_model, but tensorflowjs_converter didn't allow that. I would like the model to eventually have multiple outputs, which is why I'd like to use the functional API rather than Sequential.







python tensorflow keras tensorflow.js






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 22 at 17:00









Tomka Koliada

1,2702828




1,2702828










asked Mar 22 at 16:28









justinswaneyjustinswaney

12




12












  • This may be due to a breakage in serialization format that was recently fixed, but may not have made it to nightly yet. Can you check if this works in the latest stable tf release (1.13.1) ?

    – BlessedKey
    Mar 22 at 17:55











  • I uninstalled tf-nightly-2.0-preview and installed tensorflow 1.13.1 but would get errors when importing tensorflowjs. I got ImportError: cannot import name 'convert_to_constants'

    – justinswaney
    Mar 23 at 2:14

















  • This may be due to a breakage in serialization format that was recently fixed, but may not have made it to nightly yet. Can you check if this works in the latest stable tf release (1.13.1) ?

    – BlessedKey
    Mar 22 at 17:55











  • I uninstalled tf-nightly-2.0-preview and installed tensorflow 1.13.1 but would get errors when importing tensorflowjs. I got ImportError: cannot import name 'convert_to_constants'

    – justinswaney
    Mar 23 at 2:14
















This may be due to a breakage in serialization format that was recently fixed, but may not have made it to nightly yet. Can you check if this works in the latest stable tf release (1.13.1) ?

– BlessedKey
Mar 22 at 17:55





This may be due to a breakage in serialization format that was recently fixed, but may not have made it to nightly yet. Can you check if this works in the latest stable tf release (1.13.1) ?

– BlessedKey
Mar 22 at 17:55













I uninstalled tf-nightly-2.0-preview and installed tensorflow 1.13.1 but would get errors when importing tensorflowjs. I got ImportError: cannot import name 'convert_to_constants'

– justinswaney
Mar 23 at 2:14





I uninstalled tf-nightly-2.0-preview and installed tensorflow 1.13.1 but would get errors when importing tensorflowjs. I got ImportError: cannot import name 'convert_to_constants'

– justinswaney
Mar 23 at 2:14












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55303963%2fcan-tensorflowjs-converter-work-with-keras-models-made-with-functional-api%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55303963%2fcan-tensorflowjs-converter-work-with-keras-models-made-with-functional-api%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript