Skip to content

Commit

Permalink
Exclude keras_model.py from running as separate example
Browse files Browse the repository at this point in the history
To ensure keras_model.py is run before the keras_to_MDF.py
which uses the model, I excluded them from examples and
instead import them from keras_to_MDF.py.
  • Loading branch information
davidt0x committed Mar 20, 2024
1 parent 9b59d48 commit 290cd8c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/TensorFlow/Keras/IRIS/keras_to_MDF.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
from modelspec.utils import _val_info
from modeci_mdf.execution_engine import EvaluableGraph

# Import keras_model to ensure it runs and generates the model
sys.path.append(".")
import keras_model # noqa: F401

# load the keras model
model = tf.keras.models.load_model("keras_model_on_iris.keras")

Expand Down
6 changes: 6 additions & 0 deletions examples/TensorFlow/Keras/MNIST/keras_to_MDF.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import sys

import numpy as np
import tensorflow as tf

from modeci_mdf.interfaces.keras import keras_to_mdf
from modelspec.utils import _val_info
from modeci_mdf.execution_engine import EvaluableGraph

# Import keras_model to ensure it runs and generates the model
sys.path.append(".")
import keras_model # noqa: F401

# load the keras model
model = tf.keras.models.load_model("kr_N_model.keras")

Expand Down
1 change: 1 addition & 0 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
".reconstructed.py",
"generate_json_and_scripts.py",
"pytorch_ddm.py",
"keras_model.py",
]

# Filter any excluded example scripts
Expand Down

0 comments on commit 290cd8c

Please sign in to comment.