tgc

tfjs-graph-converter

A TensorFlow.js Graph Model Converter

Showing:

11 Versions

1.4.2

Minor Patch Release Changes

Users reported errors when trying to convert Keras models (#27, #28). This patch addresses these issues by checking the model format prior to parsing and converting it. If the detected format differs from the expected TFJS graph model format, a (hopefully) more helpful error message is displayed instead of a stack trace, e.g.:

> tfjs_graph_converter keras-model.json /home/user/models/ --output_format=tf_saved_model
> TensorFlow.js Graph Model Converter

Graph model:    keras-model.json
Output:         /home/user/models/
Target format:  tf_saved_model

Converting.... Error: The model is a KERAS layers-model.
This converter only handles GRAPH models.
You can load and convert Keras models directly (using Python):

        import tensorflowjs as tfjs

        model = tfjs.converters.load_keras_model("keras-model.json")
        model.save("/home/user/models")
>
Installation

Via pypi: pip install -U tfjs-graph-converter

From source directory: pip install .

1.4.1

Minor Bugfix Release Bugfixes
  • Tensorflow log message spamming wasn't suppressed as it's supposed to
  • enabled CUDA GPU could cause the converter to freeze mid-conversion
  • source code: some type hints were missing or wrong
Installation

Via pypi: pip install -U tfjs-graph-converter

From source directory: pip install .

1.4.0

TFJS Graph Model Converter 1.4.0

This release adds a new flag for improved model compatibility with TensorflowJS for NodeJS. Converted models that have int64 inputs aren't supported by tf.node. Using the new flag --compat_mode, the converted model will now convert the input datatype to be compatible with TFJS ≤v2.4.0.

Features
  • New flag --compat_mode / -c for TFJS compatibility
Fixed Issues
  • Fixed issue #23
Installation

Use pip install -U tfjs-graph-converter to install or upgrade to the current version

1.3.1

TFJS Graph Converter 1.3.1

This is a minor patch that fixes an issue with certain models that would prevent these models to be converted.

Features
  • Fixed issue #21 by supporting models with mismatching tensor data and graph nodes (e.g. toxicity)
Installation

To update an existing installation you can use

pip install -U tfjs-graph-model-converter

1.3.0

1.2.0

1.1.2

Bug Fixes

This release fixes an issue (#15) with signature generation if the model doesn't contain signature meta data and uses dynamic tensor dimensions.

Details

Some models (e.g. posenet/resnet50) don't contain signature meta data. In this case, the converter tries to "guess" the correct model signature.

This works by identifying inputs and outputs and selecting the tensor dimensions accordingly. Unfortunately, due to a coding error, unspecified (i.e. dynamic) dimensions where ignored instead of written as "-1" as per TF conventions. This lead to a mismatch in (output-) tensor dimensions.

Another minor issue arose from naming. While models with proper signature meta data used the tensor name (e.g. including channel id) as key, SavedModel signatures usually don't include the channel id. This has been fixed as well, so even if the signature is taken directly from the model itself, any channel ids will be removed.

1.1.1

This release fixes a compatibility issue with the latest versions (v2.2 and v2.3) of tensorflow (see #14).

1.1.0

1.0.1

Bug Fixes
  • Specifying SavedModel-tags on the command line resulted in tags being broken into individual letters

Big thanks to PapaEcureuil for finding the bug and submitting the fix!

1.0.0

Version 1.0 Release 🎉

This is a big one. First of all, thanks to the feedback I received, this package can now be found on PyPi. Installing via pip install tfjs-graph-converter is now possible 👍

Breaking Changes
  • package name changed from tfjs_graph_converter to tfjs-graph-converter; make sure to use pip uninstall tfjs_graph_converter before upgrading to this release
Features
  • Added support for models that use PReLU activation
  • Added additional graph optimisation (since models may now be rewritten)
  • Added complete suite of unit tests covering all public functions
  • Updated the documentation to include most modules
  • Package now available on PyPi
  • Extended API to include functions for wrapping loaded models in TF2 functions
Bug fixes
  • Reverted a change that altered the return value of load_graph_model() from tf.Graph to GraphDef protocol message, which caused problems for some users
  • Fixed a bug in node naming that could have lead to failed conversions