tutel icon indicating copy to clipboard operation
tutel copied to clipboard

How to define a custom gate function in moe_layer

Open lihuanihao opened this issue 11 months ago • 2 comments

Hello, thank you for your very useful codebase. I would like to know how to define a custom gate function in the moe_layer, like self._layer = moe_layer(gate_type={'type': 'custom','module': CustomGate, ... }?

lihuanihao avatar Jan 17 '25 07:01 lihuanihao

You can upgrade tutel to include latest commit, then follow this example:

https://github.com/microsoft/Tutel/blob/main/tutel/examples/helloworld_custom_gate_expert.py#L53-L118

Example script: python3 -m tutel.examples.helloworld_custom_gate_expert

ghostplant avatar Jan 18 '25 00:01 ghostplant