#8734·tfjs

Converting *.h5 model with tfjs

Author: m4rtin1Created Jul 14, 2026Updated Jul 31, 2026
Labelstype:othersstat:awaiting tensorflower

I am working on a project where I need to convert my *.h5 model to use it with javascript, I wanted to convert the model with tensorflowjs using the code:

import tensorflowjs as tfjs
tfjs.converters.save_keras_model(model, "tfjs_models")

an error occured saying something about deprecated np.object type. I fixed this error by replacing np.object with object in file: /venv/lib/python3.13/site-packages/tensorflowjs/write_weights.py and /venv/lib/python3.13/site-packages/tensorflowjs/read_weights.py on lines 27 and 28. But it did not help.

A new error saying module 'tensorflow.compat.v1' has no attribute 'estimator'

my system information

  • fedora linux 44
  • python 3.13.14
  • pip 26.1.2
  • tensorflow 2.21.0
  • tensorflowjs 3.18.0
  • keras 3.15.0