FinRL icon indicating copy to clipboard operation
FinRL copied to clipboard

AttributeError when running "python main.py --mode=train" command

Open varunpan opened this issue 1 year ago • 4 comments

Im getting an error when running "python main.py --mode=train" command. See below for for the full error traceback:

Traceback (most recent call last):
  File "/Users/varunpanchal/Documents/Projects/FinRLMain/FinRL/finrl/main.py", line 152, in <module>
    raise SystemExit(main())
  File "/Users/varunpanchal/Documents/Projects/FinRLMain/FinRL/finrl/main.py", line 71, in main
    train(
  File "/Users/varunpanchal/miniforge3/envs/finrlmain/lib/python3.9/site-packages/finrl/train.py", line 60, in train
    trained_model = agent.train_model(
  File "/Users/varunpanchal/miniforge3/envs/finrlmain/lib/python3.9/site-packages/finrl/agents/elegantrl/models.py", line 84, in train_model
    train_and_evaluate(model)
  File "/Users/varunpanchal/miniforge3/envs/finrlmain/lib/python3.9/site-packages/elegantrl/train/run.py", line 80, in train_and_evaluate
    trajectory, step = agent.explore_env(env, horizon_len, False)
  File "/Users/varunpanchal/miniforge3/envs/finrlmain/lib/python3.9/site-packages/elegantrl/agents/AgentPPO.py", line 89, in explore_one_env
    return self.convert_trajectory(traj_list, last_done)  # traj_list
  File "/Users/varunpanchal/miniforge3/envs/finrlmain/lib/python3.9/site-packages/elegantrl/agents/AgentBase.py", line 260, in convert_trajectory
    pre_item = self.traj_list[env_i][j]
AttributeError: 'AgentPPO' object has no attribute 'traj_list'

To Reproduce Steps to reproduce the behavior:

  1. run python main.py --mode=train

Desktop (please complete the following information):

  • Device: MacBook with Apple Silicon
  • OS: Mac OS
  • Python: 3.9

varunpan avatar Jul 09 '22 17:07 varunpan

Is this issue the same with a previous one: https://github.com/AI4Finance-Foundation/FinRL/issues/667

YangletLiu avatar Jul 09 '22 22:07 YangletLiu

No, this is not related to the replaybuffer. It's something with traj_list.

varunpan avatar Jul 09 '22 23:07 varunpan

I see. ElegantRL is updating. Not sure whether fully addressed this "traj_list" issue.

YangletLiu avatar Jul 09 '22 23:07 YangletLiu

I was able to bypass the error by following the steps provided in the link below: https://github.com/AI4Finance-Foundation/ElegantRL/issues/181#issuecomment-1176311029

However, after it run, i only have data in the ./test_ppo file. Is that expected for training?

varunpan avatar Jul 12 '22 19:07 varunpan