FinRL icon indicating copy to clipboard operation
FinRL copied to clipboard

FinRL_PaperTrading_Demo packages out of sync with ElegantRL

Open andlyu opened this issue 2 years ago • 7 comments

Description When running train fn in FinRL_PaperTrading_Demo, ElegantRL Train function is called, but it gets an error:

/usr/local/lib/python3.7/dist-packages/finrl/agents/elegantrl/models.py in get_model(self, model_name, model_kwargs) 61 if model_name not in MODELS: 62 raise NotImplementedError("NotImplementedError") ---> 63 model = Arguments(agent=agent, env=env) 64 model.if_off_policy = model_name in OFF_POLICY_MODELS 65 if model_kwargs is not None:

TypeError: __init__() got an unexpected keyword argument 'agent'.

When this issue was patched locally, other issues arose. This seems to be due to some package misalignments with newer commits.

Is there a way to use the older version of ElegantRL to rerun the notebook without issues?

To Reproduce Steps to reproduce the behavior:

  1. Run FinRL_PaperTrading_Demo in Colab

Thanks !!

andlyu avatar Jul 18 '22 08:07 andlyu

pls try Arguments(agent_class=agent, env=env). Recently, elegantrl is updated.

zhumingpassional avatar Jul 20 '22 02:07 zhumingpassional

Hey, thanks. I did that, but then I got the following error:

/usr/local/lib/python3.7/dist-packages/finrl/agents/elegantrl/models.py in train_model(self, model, cwd, total_timesteps) 82 model.cwd = cwd 83 model.break_step = total_timesteps ---> 84 train_and_evaluate(model) 85 86 @staticmethod

/usr/local/lib/python3.7/dist-packages/elegantrl/train/run.py in train_and_evaluate(args) 93 cwd = args.cwd 94 break_step = args.break_step ---> 95 horizon_len = args.horizon_len 96 if_allow_break = args.if_allow_break 97 if_off_policy = args.if_off_policy

AttributeError: 'Arguments' object has no attribute 'horizon_len'

Is there a prior version of elegantly that you'd recommend?

andlyu avatar Jul 20 '22 06:07 andlyu

pip install git+https://github.com/AI4Finance-LLC/ElegantRL.git@a2207cf

I use this version, you can try it out btw, because of the rapid development of the program, is it necessary to mark the installed version in the tutorial file as in the example above?

eithwa avatar Jul 20 '22 09:07 eithwa

pip install git+https://github.com/AI4Finance-LLC/ElegantRL.git@a2207cf

I use this version, you can try it out btw, because of the rapid development of the program, is it necessary to mark the installed version in the tutorial file as in the example above?

This solution didn't perfect for me, I have the same problem, Is someone have another solution that can help me, plz.

108360232Zijie avatar Jul 22 '22 15:07 108360232Zijie

Update: Changing drl_lib to drl_lib = 'stable_baselines3' seems to do the trick for training cells.

andlyu avatar Jul 24 '22 23:07 andlyu

Update: Changing drl_lib to drl_lib = 'stable_baselines3' seems to do the trick for training cells.

Sure. Stable_baselines3 does not update much now, so it is more stable for use.

YangletLiu avatar Jul 26 '22 05:07 YangletLiu

There's a similar issue in FinRL-Meta and you can have a check: https://github.com/AI4Finance-Foundation/FinRL-Meta/issues/202. Although with better performance and more updated construction, ElegantRL is developing rapidly so there might be issues pop up. Stable Baseline3 is a more stable choice like XiaoYang said.

ZiyiXia avatar Jul 30 '22 23:07 ZiyiXia

got error when run /FinRL/finrl/train.py FinRL/finrl/agents/elegantrl/models.py", line 63, in get_model model = Arguments(agent_class=agent, env=env) TypeError: init() got an unexpected keyword argument 'agent_class'

thanks for help!

xtuyaowu avatar Sep 22 '22 06:09 xtuyaowu

@xtuyaowu elegant is updated frequently recently. pls use pip install git+https://github.com/AI4Finance-LLC/ElegantRL.git@a2207cf or you can try add agent_class.

zhumingpassional avatar Sep 22 '22 10:09 zhumingpassional

@zhumingpassional thanks but pip install git+https://github.com/AI4Finance-LLC/ElegantRL.git@a2207cf still fail

xtuyaowu avatar Sep 23 '22 00:09 xtuyaowu