-
Notifications
You must be signed in to change notification settings - Fork 134
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
feature(pu): add UniZero algo. and related configs/utils/envs/models #232
Conversation
puyuan1996
commented
Jun 11, 2024
•
edited
Loading
edited
- Add UniZero algo. and related configs/utils/envs/models
- Our arxiv paper is on UniZero: Generalized and Efficient Planning with Scalable World Models.
… all, use batchsize 256 for tokenizer
lzero/entry/train_unizero.py
Outdated
if cfg.policy.use_priority: | ||
replay_buffer.update_priority(train_data, log_vars[0]['value_priority_orig']) | ||
|
||
# Clear caches and precompute positional embedding matrices |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move these part to the __del__
method of world_model
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因为是每个train epoch都需要调用一次,因为我在unizero中新建了一个recompute_pos_emb_diff_and_clear_cache() methid哈
""" | ||
assert embed_dim % num_heads == 0 | ||
self._n, self._cache, self._size = num_samples, None, None | ||
self._reset = lambda n: torch.empty(n, num_heads, max_tokens, embed_dim // num_heads, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why use lambda function here, rather than directly writing the implementation in reset
method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里使用 lambda function,可以避免很多参数的传递,效果是类似的