5

I have a pre trained tfjs model and I would like to load it into python using keras / tensorflow

I found how to convert a tf and a keras model to tfjs models. And how to load tfjs model using js,

How can I load the model into python?

1 Answer 1

3

You can save the tfjs model from JS using the model save API.

You can then convert the model into a python compatible format using the tfjs-converter. Finally, you should be able to use load_model in python using the keras load model API.

tf.keras.models.load_model(
   filepath,
   custom_objects=None,
   compile=True
)
Sign up to request clarification or add additional context in comments.

4 Comments

I do not need to load keras model in tf, I need to load a tfjs model in keras
You can save the tfjs model from JS using the model save API. You can then convert the model into a python compatible format using the converter. Then you should be able to use load_model in python.
This was the question, please edit the answer to that so I can accept it
Updated. Thanks. hope it helped

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.