Skip to content

Commit

Permalink
feat(components): Added converter components for TensorflowJS LayersM…
Browse files Browse the repository at this point in the history
…odel (#4527)
  • Loading branch information
Ark-kun committed Sep 21, 2020
1 parent 3927a4f commit b1f46ac
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Convert Keras HDF5 model to Tensorflow JS LayersModel
inputs:
- {name: Model, type: KerasModelHdf5}
outputs:
- {name: Model, type: TensorflowJSLayersModel}
metadata:
annotations:
author: Alexey Volkov <alexey.volkov@ark-kun.com>
implementation:
container:
image: tensorflow/tensorflow:2.3.0
command:
- sh
- -exc
- |
# Manually installing prerequisites so that tensorflowjs does not re-install tensorflow-cpu on top of tensorflow. See https://github.com/tensorflow/tfjs/issues/3953
python3 -m pip install --quiet 'h5py>=2.8.0' 'numpy>=1.16.4,<1.19.0' 'six>=1.12.0' 'tensorflow-hub==0.7.0' 'PyInquirer==1.0.3'
python3 -m pip install --quiet tensorflowjs==2.4.0 --no-dependencies
"$0" "$*"
- tensorflowjs_converter
- --input_format=keras
- --output_format=tfjs_layers_model
- inputPath: Model
- outputPath: Model
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Convert Keras SavedModel to Tensorflow JS LayersModel
inputs:
- {name: Model, type: TensorflowSavedModel}
outputs:
- {name: Model, type: TensorflowJSLayersModel}
metadata:
annotations:
author: Alexey Volkov <alexey.volkov@ark-kun.com>
implementation:
container:
image: tensorflow/tensorflow:2.3.0
command:
- sh
- -exc
- |
# Manually installing prerequisites so that tensorflowjs does not re-install tensorflow-cpu on top of tensorflow. See https://github.com/tensorflow/tfjs/issues/3953
python3 -m pip install --quiet 'h5py>=2.8.0' 'numpy>=1.16.4,<1.19.0' 'six>=1.12.0' 'tensorflow-hub==0.7.0' 'PyInquirer==1.0.3'
python3 -m pip install --quiet tensorflowjs==2.4.0 --no-dependencies
"$0" "$*"
- tensorflowjs_converter
- --input_format=keras_saved_model
- --output_format=tfjs_layers_model
- inputPath: Model
- outputPath: Model

0 comments on commit b1f46ac

Please sign in to comment.