You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I appreciate any help
reading the book to:
-Chapter 4: Reinforcement Learning in the Real World – Building Cryptocurrency Trading Agents
-Training a cryptocurrency trading bot using RL
and run flowing code : Tensorflow-2-Reinforcement-Learning-Cookbook/Chapter04/sac_agent.ipynb
I got problem this part:
def test(self, render=True, fps=30, filename="test_render.mp4"):
cur_state, done, rewards = self.env.reset(), False, 0
# video = imageio.get_writer(filename, fps=fps )
video = imageio.get_writer(filename)
while not done:
action = self.act(cur_state, test=True)
next_state, reward, done, _ = self.env.step(action[0])
cur_state = next_state
rewards += reward
if render:
video.append_data(self.env.render(mode="rgb_array"))
video.close()
return rewards
giving this error
in test(self, render, fps, filename)
320 rewards += reward
321 if render:
--> 322 video.append_data(self.env.render(mode="rgb_array"))
323 video.close()
324 return rewards
/usr/local/lib/python3.7/dist-packages/imageio/core/format.py in append_data(self, im, meta)
483 # Check image data
484 if not isinstance(im, np.ndarray):
--> 485 raise ValueError("append_data requires ndarray as first arg")
486 # Get total meta dict
487 total_meta = {}
ValueError: append_data requires ndarray as first arg
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I appreciate any help
reading the book to:
-Chapter 4: Reinforcement Learning in the Real World – Building Cryptocurrency Trading Agents
-Training a cryptocurrency trading bot using RL
and run flowing code : Tensorflow-2-Reinforcement-Learning-Cookbook/Chapter04/sac_agent.ipynb
I got problem this part:
def test(self, render=True, fps=30, filename="test_render.mp4"):
cur_state, done, rewards = self.env.reset(), False, 0
# video = imageio.get_writer(filename, fps=fps )
video = imageio.get_writer(filename)
while not done:
action = self.act(cur_state, test=True)
next_state, reward, done, _ = self.env.step(action[0])
cur_state = next_state
rewards += reward
if render:
video.append_data(self.env.render(mode="rgb_array"))
video.close()
return rewards
giving this error
ValueError Traceback (most recent call last)
in ()
11 # sac.train(max_epochs=1000, random_epochs=100, save_freq=50)
12
---> 13 reward = sac.test()
14 print(reward)
15 # tensorboard –-logdir=logs
in test(self, render, fps, filename)
320 rewards += reward
321 if render:
--> 322 video.append_data(self.env.render(mode="rgb_array"))
323 video.close()
324 return rewards
/usr/local/lib/python3.7/dist-packages/imageio/core/format.py in append_data(self, im, meta)
483 # Check image data
484 if not isinstance(im, np.ndarray):
--> 485 raise ValueError("append_data requires ndarray as first arg")
486 # Get total meta dict
487 total_meta = {}
ValueError: append_data requires ndarray as first arg
Beta Was this translation helpful? Give feedback.
All reactions