From 5dcac3a939a50507751b33c35c85c808533df00b Mon Sep 17 00:00:00 2001 From: AkashKarnatak <54985621+AkashKarnatak@users.noreply.github.com> Date: Thu, 15 Jun 2023 16:39:24 +0530 Subject: [PATCH] Fixes #1010 and #1022 (#1034) * After [this](https://github.com/DLR-RM/stable-baselines3/commit/9c338f917a822c8be13b1aa9f7b2319770481b62) by `stable-baselines3`, DummyVecEnv.reset() method passes a `seed` argument to its list of envs. Since StockTradingEnv.reset() does not expect any argument it results in an error. This commit fixes #1022. * DummyVecEnv.render() no longer returns the expected state after [this](https://github.com/DLR-RM/stable-baselines3/pull/1327) pull request got merged in `stable-baselines3`. This commit fixes #1010 --- finrl/agents/stablebaselines3/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/finrl/agents/stablebaselines3/models.py b/finrl/agents/stablebaselines3/models.py index 3d627b11b..32e317a57 100644 --- a/finrl/agents/stablebaselines3/models.py +++ b/finrl/agents/stablebaselines3/models.py @@ -316,7 +316,7 @@ def DRL_prediction( trade_obs, rewards, dones, info = trade_env.step(action) if i == (len(trade_data.index.unique()) - 2): # print(env_test.render()) - last_state = trade_env.render() + last_state = trade_env.envs[0].render() df_last_state = pd.DataFrame({"last_state": last_state}) df_last_state.to_csv(f"results/last_state_{name}_{i}.csv", index=False)