Skip to content
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(zjow): add agent class to support LightZero's HuggingFace Model Zoo #163

Merged
merged 3 commits into from
Dec 5, 2023

Conversation

zjowowen
Copy link
Contributor

@zjowowen zjowowen commented Dec 5, 2023

This pull request adds class Agent for LightZero, which enables training or deploying as an agent. It allows model checkpoints to be push to or pull from Huggingface by using Huggingface_ding.

@puyuan1996 puyuan1996 added enhancement New feature or request config New or improved configuration labels Dec 5, 2023
lzero/agent/__init__.py Show resolved Hide resolved
lzero/agent/config/muzero/__init__.py Show resolved Hide resolved
gradient_logger=False, video_logger=False, plot_logger=False, action_logger=False, return_logger=False
),
),
create_config=dict(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的config是专门用于新写的 muzero class的config吗?以后所有的config相当于都需要再这里重写一份,应该可以写一个转换函数,把LZ原来的config转换成这里需要格式的config,然后就可以避免冗余代码了吧?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我不太推荐写个转换函数,最好是代码里写的就是Agent load的,这样比较直接。(以后如果不用这一些config了,删了就算废弃了,不会牵扯到其它组件。)(如果写转换函数的话,我对未来的兼容性承诺保持怀疑。而且不易读。)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的哈

from lzero.mcts import MuZeroGameBuffer


class MuZeroAgent:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里MuZeroAgent 应该是支持我们LZ原来的所有Muzero系列算法吧?感觉之后只需要为AlphaZero再单写一个AlphaZeroAgent应该就可以了

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以使用GPT4和这里的提示词 https://aicarrier.feishu.cn/wiki/N4bqwLRO5iyQcAkb4HCcflbgnpR 【优化注释格式】 为整个class添加详细的overview格式的注释哈

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“这里MuZeroAgent 应该是支持我们LZ原来的所有Muzero系列算法吧?”
是的。

"""
Overview:
Agent class for execution MuZero algorithms. It includes train, deploy, batch_evaluate methods.
Interface:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

增加一下说明,这个agent类主要是为了方便用于 HuggingFace Model Zoo for LightZero 相关的 "train, deploy"这些操作?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已经加好了哈

@puyuan1996 puyuan1996 changed the title feature(zjow): add agent class for lightzero feature(zjow): add agent class to support LightZero's HuggingFace Model Zoo Dec 5, 2023
@puyuan1996 puyuan1996 merged commit b6fd371 into opendilab:main Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config New or improved configuration enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants