1 Star 0 Fork 24

吴海洪/future_agent

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
test_rppo.py 876 Bytes
一键复制 编辑 原始数据 按行查看 历史
邹吉华 提交于 2023-04-04 17:20 . 1.3.1
import numpy as np
from sb3_contrib import RecurrentPPO
from stable_baselines3.common.evaluation import evaluate_policy
from helper import *
if __name__ == '__main__':
env = get_dummy_env(1,True)
model = RecurrentPPO.load("./model/rppo/best_model_1")
#mean_reward, std_reward = evaluate_policy(model, env,1)
#print(f"{mean_reward} {std_reward}")
obs = env.reset()
# cell and hidden state of the LSTM
lstm_states = None
# Episode start signals are used to reset the lstm states
episode_starts = np.ones((env.num_envs,), dtype=bool)
while True:
action, lstm_states = model.predict(obs, state=lstm_states, episode_start=episode_starts)
obs, rewards, dones, info = env.step(action)
episode_starts = dones
env.render()
if dones :
env.close()
break
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/highgodudu1982/future_agent.git
[email protected]:highgodudu1982/future_agent.git
highgodudu1982
future_agent
future_agent
master

搜索帮助