新增 DoubleDQN 训练与评估脚本与配置文件,且更改了目录#3270
Closed
GODDDDD22311 wants to merge 1 commit into
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修改概述:
新增 configs/double_dqn.yaml:在基础 DQN 配置之上扩展 DoubleDQN 相关超参数(tau、update_target_every)。
新增 eval_doubledqn.py:加载 DoubleDQN.pt 进行评估,提供预处理流水线,并使用 RecordVideo 输出评估视频。
更改了代码的目录,层次更加清晰
实现功能
配置扩展
基于 _extends: ./dqn.yaml 继承基础配置,并新增/覆盖 tau: 0.005、update_target_every: 10000。
评估与视频录制
使用 CarRacing-v3(continuous=False,render_mode="rgb_array"),并通过 RecordVideo 将评估过程保存到指定目录。
评估时关闭探索(agent.epsilon = 0),按 episode seed 逐局运行,打印单局分数并输出平均分。
预处理链路:SkipFrame(skip=4) + GrayscaleObservation + ResizeObservation(84,84) + FrameStackObservation(stack_size=4)。
经过了什么样的测试?
本地评估验证:在存在 DoubleDQN.pt 的情况下运行 python eval_doubledqn.py,确认可正常输出每回合 score 与平均 score,并生成视频文件。
依赖说明:如启用 RecordVideo 录制视频,请确保环境已安装 moviepy(否则 Gymnasium 会报依赖缺失)。
运行效果
动图、视频、截图等