-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如何存储和读取replay buffer为h5文件 #529
Comments
你这里要缓存的数据是指,是 replay buffer 里的数据吗,具体有多大 |
是的,大概12M条,直接保存h5内存根本放不下保存过程中产生的数据,需要分块保存。 我之前用 obs大小大概如下: self._observation_space = _observation_space = gym.spaces.Dict(
{
'agent_state': gym.spaces.Box(
low=-1, high=1, shape=(4,336), dtype=np.float32
),
'global_state': gym.spaces.Box(
low=-1, high=1, shape=(4, 994), dtype=np.float32
)
}
) |
|
目前我用的是sac算法,需要做obs缩放,所以obs用的是-1到1的区间。
replay buffer我是这么用的,1、因为我的env使用了大量数据,数据的质量不一定可控,而且我的env可能会出现bug,为了避免训练时出现异常,我采用了定期存replay buffer的方法,出现异常后可以继续训练。2、我的数据每天更新,因为sac是off-policy,所以第二次训练时,网络权重从0开始,并且读上次训练出好的模型的replay buffer,可以提高成绩。 |
明白了,所以其实你的需求更简单,只需要自动定期存储replay buffer中的数据,且能够在重新训练的时候加载进来就可以了对吧 |
是的,很简单。只要能把replay buffer分文件保存和读取就行了,保存h5时使用zip算法压缩。 |
相关功能已在 #542 中实现 |
请问:
1、缓存如何存为h5,并且如何读缓存
2、需要定期存缓存时,缓存如果过大,如何切割存为h5,并且如何读缓存
The text was updated successfully, but these errors were encountered: