-
Notifications
You must be signed in to change notification settings - Fork 21
Refactor PEER #123
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
base: main
Are you sure you want to change the base?
Refactor PEER #123
Conversation
| @dataclass | ||
| class PEERConfig(ModifierConfig): | ||
| n_heads: int = 8 | ||
| moe__num_experts: int = 100 |
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.
two __
| def experts_names(self): | ||
| return self.model.experts_names | ||
|
|
||
| def get_expert_instance(self, name): |
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.
this is only available for multiexpert, i am not sure to add this dependency here
| module = MultiExpertModule(**vars(expert.training_config)).to("cuda") | ||
| module.add_expert_instance(expert, is_default=True) | ||
|
|
||
| elif args.merge_or_route in ["peer"]: |
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.
can you explain what you are trying to do?
| for expert_name in module.experts_names: | ||
| expert = module.get_expert_instance(expert_name) | ||
| expert: Expert = module.get_expert_instance(expert_name) | ||
| expert.expert_info.training_config = args |
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.
remove this, not a good idea to store complex object in training_config, it will be transformed to a Dict in the next PR :)
| self.selector = selector or TaskNameSelector() | ||
| self._default_expert_name = None | ||
| self.expert_infos = {} | ||
| self.experts = nn.ModuleDict({}) |
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.
not all containers have "experts", see my last PR on making LoRA faster
| self.experts = nn.ModuleDict({}) | ||
|
|
||
| @property | ||
| def num_experts(self): |
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.
let's use len(self)
TODO: