-
Notifications
You must be signed in to change notification settings - Fork 283
Add Qwen3 Moe #2260
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: master
Are you sure you want to change the base?
Add Qwen3 Moe #2260
Conversation
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.
Thanks! Took an initial pass. Let's try to clean up the config and state passing.
No passing an index down the layer stack, plus data structures that apply to the whole layer stack.
self, | ||
num_query_heads, | ||
num_key_value_heads, | ||
layer_index, |
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 layer index is gross, let's remove it. Handle the args properly in the backbone and pass the correct sliding_window_size
to this layer and the decoder layer above it.
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.
since it's an Moe, layer index is not just used for sliding window but for experts
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.
I replaced this passing of layer_index
, decoder_sparse_step
and mlp_only_layers
with a single boolean switch:
model(input_data) | ||
""" | ||
|
||
def __init__( |
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.
In general, let's make sure we prune this list down just to the config options we need.
sliding_window_size=32768, | ||
output_router_logits=False, | ||
router_aux_loss_coefficient=0.001, | ||
mlp_only_layers=[], |
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.
Fine to have something like this for the toplevel, but let's pass something more direct to each decoder layer (so we don't need to pass the index down). Make sure to document if we keep it.
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.
but let's pass something more direct to each decoder layer
what do you suggest?
No description provided.