Skip to content

Commit

Permalink
Fix model loading - Using tensorflow1.15@nv43
Browse files Browse the repository at this point in the history
  • Loading branch information
SippieCup committed Apr 19, 2020
1 parent 8ddf155 commit ceb33d5
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 17 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ models/segnet2.keras filter=lfs diff=lfs merge=lfs -text
external/opencl/*.deb filter=lfs diff=lfs merge=lfs -text
phonelibs/zmq/aarch64-linux/lib/libzmq.a filter=lfs diff=lfs merge=lfs -text
external/azcopy/azcopy filter=lfs diff=lfs merge=lfs -text
models/** filter=lfs diff=lfs merge=lfs -text
4 changes: 2 additions & 2 deletions models/dmonitoring_model.model.keras
Git LFS file not shown
2 changes: 1 addition & 1 deletion models/dmonitoring_model.weights.keras
Git LFS file not shown
4 changes: 2 additions & 2 deletions models/supercombo.keras
Git LFS file not shown
4 changes: 2 additions & 2 deletions models/supercombo.model.keras
Git LFS file not shown
4 changes: 2 additions & 2 deletions models/supercombo.weights.keras
Git LFS file not shown
11 changes: 4 additions & 7 deletions selfdrive/modeld/runners/keras_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,12 @@ def run_loop(m):
if len(gpus) > 0:
if os.path.splitext(os.path.basename(sys.argv[1]))[0]== "supercombo":
tf.config.experimental.set_virtual_device_configuration(gpus[0], [tf.config.experimental.VirtualDeviceConfiguration(memory_limit=2548)])
with open(f"{os.path.splitext(sys.argv[1])[0]}.model.keras", "r") as json_file:
m = model_from_json(json_file.read())
m.load_weights(f"{os.path.splitext(sys.argv[1])[0]}.weights.keras")
else:
tf.config.experimental.set_virtual_device_configuration(gpus[0], [tf.config.experimental.VirtualDeviceConfiguration(memory_limit=256)])
m = load_model(sys.argv[1], compile=False)
else:
m = load_model(sys.argv[1], compile=False)
with open(f"{os.path.splitext(sys.argv[1])[0]}.model.keras", "r") as json_file:
m = model_from_json(json_file.read())
m.load_weights(f"{os.path.splitext(sys.argv[1])[0]}.weights.keras")

bs = [int(np.product(ii.shape[1:])) for ii in m.inputs]
ri = keras.layers.Input((sum(bs),))
tii = []
Expand Down

0 comments on commit ceb33d5

Please sign in to comment.