Skip to content

Commit

Permalink
Solved error when training the model on OpenBot Driving Policy Trainer (
Browse files Browse the repository at this point in the history
#403)

* Update policy_learning.ipynb
* Update train.py
  • Loading branch information
M-S-10 authored May 2, 2024
1 parent 3c7c50f commit 7fd9e8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion policy/openbot/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,10 @@ def do_training(tr: Training, callback: tf.keras.callbacks.Callback, verbose=0):
tr.hyperparameters.BATCH_NORM,
tr.hyperparameters.POLICY,
)
dot_img_file = os.path.join(models_dir, tr.model_name, "model.png")
# Define the directory where the model image should be saved (if not already created)
model_dir = os.path.join(models_dir, tr.model_name)
os.makedirs(model_dir, exist_ok=True)
dot_img_file = os.path.join(model_dir, "model.png")
tf.keras.utils.plot_model(model, to_file=dot_img_file, show_shapes=True)

callback.broadcast("model", tr.model_name)
Expand Down
2 changes: 2 additions & 0 deletions policy/policy_learning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@
"metadata": {},
"outputs": [],
"source": [
"# Create the directory if it doesn't exist\n",
"os.makedirs(os.path.join(os.getcwd(), \"models\", tr.model_name), exist_ok=True)\n\n",
"# params.NUM_EPOCHS = 200\n",
"# params.USE_LAST = True\n",
"train.do_training(tr, my_callback, verbose=1)"
Expand Down

0 comments on commit 7fd9e8f

Please sign in to comment.