Skip to content

Commit

Permalink
Merge pull request #8 from asu-cactus/revision
Browse files Browse the repository at this point in the history
clean up code
  • Loading branch information
lixi-zhou authored Sep 4, 2023
2 parents e8f9f34 + 9086dc7 commit d4ca650
Show file tree
Hide file tree
Showing 15 changed files with 1,846 additions and 1,662 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
**/.ipynb_checkpoints/**
**.tbl
**/.vscode
**/DeepMapping.egg-info
**/DeepMapping.egg-info
**.7z
**.onnx
322 changes: 128 additions & 194 deletions DeepMapping/DeepMapping/byte_dictionary_compression.py

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions DeepMapping/DeepMapping/convert_model_from_h5_to_onnx.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os
import shutil
import tensorflow as tf

"""This script is used to convert the h5 model into onnx format,
if you want to use onnxrunutime as backend.
You are required to install tf2onnx by using pip.
"""

for root, dirs, files in os.walk("models/nas/tpch-s1/", topdown=False):
for name in files:
if '.h5' in name:
model_name = name.split('.')[0]
# h5 file
model_path = os.path.join(root, name)

model = tf.keras.models.load_model(model_path, compile=False)
# save in pb
model.save(os.path.join(root, model_name))
cmd = "python -m tf2onnx.convert --saved-model {} --output {}.onnx".format(os.path.join(root, model_name),
os.path.join(root, model_name))
os.system(cmd)
shutil.rmtree(os.path.join(root, model_name))
print(root, name, cmd)
Loading

0 comments on commit d4ca650

Please sign in to comment.