AI4Finance-Foundation / FinRL-Meta

FinRL­-Meta: Dynamic datasets and market environments for FinRL.
https://ai4finance.org
MIT License
1.26k stars 582 forks source link

AttributeError: 'NoneType' object has no attribute 'config' #28

Closed uh-reza closed 2 years ago

uh-reza commented 2 years ago

Hi, train RLlib come up with following error

~/anaconda3/lib/python3.7/site-packages/ray/worker.py in get(object_refs, timeout) 1625 raise value.as_instanceof_cause() 1626 else: -> 1627 raise value 1628 1629 if is_individual_id:

RayActorError: The actor died because of an error raised in its creation task, ray::RolloutWorker.init() (pid=43634, ip=192.168.1.81) AttributeError: 'NoneType' object has no attribute 'config'

During handling of the above exception, another exception occurred:

ray::RolloutWorker.init() (pid=43634, ip=192.168.1.81) File "/home/reza/anaconda3/lib/python3.7/site-packages/ray/rllib/evaluation/rollout_worker.py", line 565, in init devices = get_tf_gpu_devices() File "/home/reza/anaconda3/lib/python3.7/site-packages/ray/rllib/utils/tf_ops.py", line 54, in get_gpu_devices devices = tf.config.experimental.list_physical_devices() AttributeError: 'NoneType' object has no attribute 'config'

it seems that is due to Tensorflow TensorBoard ... any idea, how can we sort it out? regards

Athe-kunal commented 2 years ago

I am not sure why it is using Tensorflow as the code is written on PyTorch. So try changing the model_config['framework']='torch' I am not sure though but Tensorflow is not installed hence NoneType don't have attribute config

zhumingpassional commented 2 years ago

ElegantRL is developed using torch. Please use torch instead of tensorflow.

uh-reza commented 2 years ago

thank for the suggestions, I have installed FinRL-Meta on 20.04 as scratch, based on Demo_Plug_and_Play_with_DRL_Libraries.ipynb

ubuntu 20.04 conda 4.8.2 python 3.7.6 pip 20.0.2

I don’t know what part of installation should be changed, any suggestion?

Athe-kunal commented 2 years ago

Before passing model_config to train_model, just do

model_config['framework'] = 'torch'

uh-reza commented 2 years ago

thank you, it worked fro Train (RLlib), but still problem is in Test (RLlib) with following error message, any advise? I need to mention somehow the Torch, but don't know exactly where!

(pid=5609) 2021-12-06 13:42:38,359 ERROR worker.py:425 -- Exception raised in creation task: The actor died because of an error raised in its creation task, ray::RolloutWorker.init() (pid=5609, ip=192.168.1.81) (pid=5609) AttributeError: 'NoneType' object has no attribute 'config' (pid=5609) (pid=5609) During handling of the above exception, another exception occurred: (pid=5609) (pid=5609) ray::RolloutWorker.init() (pid=5609, ip=192.168.1.81) (pid=5609) File "/home/reza/anaconda3/lib/python3.7/site-packages/ray/rllib/evaluation/rollout_worker.py", line 565, in init (pid=5609) devices = get_tf_gpu_devices() (pid=5609) File "/home/reza/anaconda3/lib/python3.7/site-packages/ray/rllib/utils/tf_ops.py", line 54, in get_gpu_devices (pid=5609) devices = tf.config.experimental.list_physical_devices() (pid=5609) AttributeError: 'NoneType' object has no attribute 'config' (pid=5607) 2021-12-06 13:42:38,359 ERROR worker.py:425 -- Exception raised in creation task: The actor died because of an error raised in its creation task, ray::RolloutWorker.init() (pid=5607, ip=192.168.1.81) (pid=5607) AttributeError: 'NoneType' object has no attribute 'config' (pid=5607) (pid=5607) During handling of the above exception, another exception occurred: (pid=5607) (pid=5607) ray::RolloutWorker.init() (pid=5607, ip=192.168.1.81) (pid=5607) File "/home/reza/anaconda3/lib/python3.7/site-packages/ray/rllib/evaluation/rollout_worker.py", line 565, in init (pid=5607) devices = get_tf_gpu_devices() (pid=5607) File "/home/reza/anaconda3/lib/python3.7/site-packages/ray/rllib/utils/tf_ops.py", line 54, in get_gpu_devices (pid=5607) devices = tf.config.experimental.list_physical_devices() (pid=5607) AttributeError: 'NoneType' object has no attribute 'config'

Athe-kunal commented 2 years ago

Similarly for test, I suppose

uh-reza commented 2 years ago

thank you, :)