wassname / rl-portfolio-management

Attempting to replicate "A Deep Reinforcement Learning Framework for the Financial Portfolio Management Problem" https://arxiv.org/abs/1706.10059 (and an openai gym environment)
552 stars 180 forks source link

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

Open watermeloncq opened 4 years ago

watermeloncq commented 4 years ago

Hello wassname: I got a problem with your code, when i run your code of tensorforce-PPO-IEET.ipynb, it got a mistake: AttributeError: 'NoneType' object has no attribute 'run'. The detail shows below:

episodes=1 steps=environment_test.gym.env.env.src.steps*episodes runner_test.run( episodes=episodes, timesteps=steps, deterministic=True, episode_finished=episode_finished, ) --------------------------------error message------------------------------

AttributeError Traceback (most recent call last)

in 5 timesteps=steps, 6 deterministic=True, ----> 7 episode_finished=episode_finished, 8 ) ~\Anaconda3\envs\ppo\lib\site-packages\tensorforce\execution\runner.py in run(self, timesteps, episodes, max_episode_timesteps, deterministic, episode_finished) 89 self.start_time = time.time() 90 ---> 91 self.agent.reset() 92 93 self.episode = self.agent.episode ~\Anaconda3\envs\ppo\lib\site-packages\tensorforce\agents\agent.py in reset(self) 113 timestep counter, internal states, and resets preprocessors. 114 """ --> 115 self.episode, self.timestep, self.next_internals = self.model.reset() 116 self.current_internals = self.next_internals 117 ~\Anaconda3\envs\ppo\lib\site-packages\tensorforce\models\model.py in reset(self) 1232 """ 1233 # TODO preprocessing reset call moved from agent -> 1234 episode, timestep = self.monitored_session.run(fetches=(self.episode, self.timestep)) 1235 return episode, timestep, list(self.internals_init) 1236 ~\Anaconda3\envs\ppo\lib\site-packages\tensorflow\python\training\monitored_session.py in run(self, fetches, feed_dict, options, run_metadata) 516 Same as `tf.Session.run()`. 517 """ --> 518 return self._sess.run(fetches, 519 feed_dict=feed_dict, 520 options=options, AttributeError: 'NoneType' object has no attribute 'run' -------------------------------------------------------------------------------------- I don't know what's wrong with it, the packages that i installed are entirely consistent with the requirements.txt。Would you please help me?
watermeloncq commented 4 years ago

I found the requirements.txt has a mistake. If you use tensorflow-cpu, the version of tensorflow should be above 1.3.0, otherwise you would get a mistake at the trainging part of tensorforce-PPO-IEET.ipynb. And I found tensorflow version1.5.0 or higher could work through the Training part of this code(tensorforce-PPO-IEET.ipynb), however, no matter how many times i try, i will get a AtrributeError at the Testing part just shows above. I don't know what's wrong with it, it almost confused me. Nonetheless, thank wassname to offer this intelligent code, i learn a lot from it.

stewartyoung commented 4 years ago

@watermeloncq Have you managed to find a solution? I have encountered the same error whilst trying to use this repo for a masters dissertation.

watermeloncq commented 4 years ago

@watermeloncq Have you managed to find a solution? I have encountered the same error whilst trying to use this repo for a masters dissertation.

I haven't find a solution about this.