Closed l976308589 closed 3 years ago
Hi @l976308589 ! Thanks for using tf2rl. I updated example scripts under examples so that users can easily load trained models and evaluate them. Specifically, I added the following four lines that periodically searches and loads if a new trained model is created. You can use the same codes for your own usage.
if args.evaluate:
trainer.evaluate_policy_continuously()
else:
trainer()
Please update the repo and refer the following example that loads a trained model and visualizes its rollouts:
# Save model
$ python examples/run_sac.py --env-name HalfCheetah-v2 --max-steps 100000 --save-model-interval 100000
# Check if models are saved
$ ls results/20210313T105002.363354_SAC_/
20210313T105002.472563.log ckpt-1.index git-head.txt
args.txt command.txt git-log.txt
checkpoint environ.txt git-status.txt
ckpt-1.data-00000-of-00002 events.out.tfevents.1615600202.elnuc7-33.30895.553.v2
ckpt-1.data-00001-of-00002 git-diff.txt
# Load model and evaluate it
$ python examples/run_sac.py --env-name HalfCheetah-v2 --evaluate --model-dir results/20210313T105002.363354_SAC_/ --show-test-progress
Attaching a movie that shows the rollouts using the latest model. https://user-images.githubusercontent.com/7234712/111015476-48b0d100-83ec-11eb-894d-87498514b3b4.mp4
thanks,got it
Dear Author: I have trained the model, but do not know how to use the trained model in my game. May I have same example? thanks again!