【发布时间】:2022-08-08 16:38:52
【问题描述】:
我正在使用 RL 编写自动驾驶代码。我正在使用一个稳定的baseline3 和一个开放的ai 健身房环境。我在 jupyter notebook 中运行以下代码,它给了我以下错误:
# Testing our model
episodes = 5 # test the environment 5 times
for episodes in range(1,episodes+1): # looping through each episodes
bs = env.reset() # observation space
# Taking the obs and passing it through our model
# tells that which kind of the action is best for our work
done = False
score = 0
while not done:
env.render()
action, _ = model.predict(obs) # now using model here # returns model action and next
state
# take that action to get the best reward
# for observation space we get the box environment
# rather than getting random action we are using model.predict(obs) on our obs for an
curr env to gen the action inorder to get best possible reward
obs, reward, done, info = env.step(action) # gies state, reward whose value is 1
# reward is 1 for every step including the termination step
score += reward
print(\'Episode:{},Score:{}\'.format(episodes,score))\'\'\'
env.close()
我编写的代码的链接如下: https://drive.google.com/file/d/1JBVmPLn-N1GCl_Rgb6-qGMpJyWvBaR1N/view?usp=sharing
我使用的python版本是Anaconda Environment中的Python 3.8.13。 我使用的是 Pytorch CPU 版本,操作系统是 Windows 10。 请帮我解决这个问题。
标签: python reinforcement-learning openai-gym stable-baselines