Skip to content

Commit

Permalink
Update train_rl_agent.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Seanman519 authored Apr 1, 2024
1 parent 4f933ed commit 8c9d70c
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions rlbot/workflows/train_rl_agent.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
"""Train rl agent.
Process for training agent
"""
from __future__ import annotations

import os
Expand All @@ -14,7 +9,7 @@
from ray.rllib.algorithms.impala import ImpalaConfig as RLAlgorithmConfig
from ray.rllib.models import ModelCatalog

from rlbot.gym_env.gym_env import FxEnv
from releat.gym_env.gym_env import FxEnv


def train_rl_agent(config, AgentModel):
Expand All @@ -33,7 +28,7 @@ def train_rl_agent(config, AgentModel):
ray.init(address="auto")

logdir = config.paths.algo_dir
ckpt_offset = max([int(x.split("/")[-1].strip()) for x in glob(f"{logdir}/0*")])
ckpt_offset = max([int(x.split("/")[-1].strip()) for x in glob(f"{logdir}/0*")], default=0)
_ = os.makedirs(logdir, exist_ok=True)

ModelCatalog.register_custom_model("AgentModel", AgentModel)
Expand Down

0 comments on commit 8c9d70c

Please sign in to comment.