SvenBecker / TAA-PG

Usage of policy gradient reinforcement learning to solve portfolio optimization problems (Tactical Asset Allocation).
33 stars 5 forks source link

unexpected keyword argument 'states_spec' #1

Open ahotrod opened 5 years ago

ahotrod commented 5 years ago

Thanks for sharing your TAA-PG project.

running train.py (and test.py) I get this error message which I've not been able to solve:

Traceback (most recent call last): File "./train.py", line 394, in run = TrainAgent(arguments) File "./train.py", line 256, in init summary_spec=self.summary_spec File "/media/dn/dssd/tensorforce_g/tensorforce/agents/agent.py", line 286, in from_spec kwargs=kwargs File "/media/dn/dssd/tensorforce_g/tensorforce/util.py", line 198, in get_object return obj(*args, **kwargs) TypeError: init() got an unexpected keyword argument 'states_spec'

Any ideas or suggestions for a fix?

Thanks again.

SvenBecker commented 5 years ago

Hi and no problem.

I assume you are using a newer version of tensorforce than 0.3.5.1?! They changed some variable names in the past and i didn't keep track of all the changes. You might consider to downgrade your tensorforce version to 0.3.5.1.

Best regards

Sven Becker

Am Di., 21. Mai 2019 um 03:20 Uhr schrieb ahotrod <notifications@github.com

:

Thanks for sharing your TAA-PG project.

running train.py (and test.py) I get this error message which I've not been able to solve:

Traceback (most recent call last): File "./train.py", line 394, in run = TrainAgent(arguments) File "./train.py", line 256, in init summary_spec=self.summary_spec File "/media/dn/dssd/tensorforce_g/tensorforce/agents/agent.py", line 286, in from_spec kwargs=kwargs File "/media/dn/dssd/tensorforce_g/tensorforce/util.py", line 198, in get_object return obj(*args, *kwargs) TypeError: init*() got an unexpected keyword argument 'states_spec'

Any ideas or suggestions for a fix?

Thanks again.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/SvenBecker/TAA-PG/issues/1?email_source=notifications&email_token=AEHJA6XSJCY4N3MDCDGRKYDPWNE6RA5CNFSM4HOGSL52YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GU3EG5A, or mute the thread https://github.com/notifications/unsubscribe-auth/AEHJA6TI3J7EUMW4FD2OLALPWNE6RANCNFSM4HOGSL5Q .

ahotrod commented 5 years ago

Thanks Sven, that was the problem. I had Tensorforce version 0.4.3 installed. Downgraded it and the 'states_spec' problem went away.

There were follow-on problems similar in nature to the 'states-spec' problem, so I "bit the bullet" and created a new virtual conda environment strictly adhering to your dependencies list. CPU training seemed to work, but slowly. So thinking I'd configure TAA-PG to run on my Nvidia GTX1080Ti GPU, I had to downgrade CUDAtoolkit to version 8 and cuDNN to version 6 for compatibility with TensorFlow 1.4.0.

Now I think running on the GTX1080Ti GPU may be slower than running just on the 12 CPU threads of my computer's Intel® Core™ i7-8700. In CPU-only mode, all 12 CPUs threads are utilized approximately 35% when running your TAA-PG app. I read that most RL/DL apps require particularly excessive back & forth transfers between CPU & GPU memory and the associated overhead negates the usual parallel processing advantages of a GPU. I then saw that Tensorforce versions 0.4 & 0.5 were/are planned to be improved to better utilize GPUs. Then there's Tensorflow 2.0 on the horizon and it may be a long while before Tensorforce is compatible … on & on … it's hard to keep-up with the changes. Hopefully the changes will settle-out soon and the changes do benefit RL/DL apps.

Thanks again, I now look forward to digging into the inner workings of your TAA-PG.

Best, Dennis

UPDATE: Converted '_model/agent_config/pposb.json' to the latest Tensorforce version 0.4.3 format to run with TensorFlow-gpu 1.13.1, CUDAtoolkit 10.0.130, and cuDNN 7.3.1. CPU-only execution time is now approximately 40% less than the execution time of the TensorFlow 1.4.0 - TensorForce 0.3.51 environment. GPU execution takes 4x the time of CPU-only execution, with approximately 35% utilization of the GPU and approx. 15% utilization of the 12 CPU threads . The system must be overwhelmed and considerably delayed with CPU-GPU memory transfers. So I'll go with CPU-only execution and focus on the RL/DL models.

scikit-learn ver 0.21.1 is flooding my screen with "Userwarning: Numerical issues were encountered when scaling the data and might not be solved. The standard deviation of the data is probably very close to 0." Earlier scikit-learn ver 0.19.1 was spitting out the same warning, but not the shear volume of ver 0.21.1. I silenced the warnings, but probably need to investigate further.