Add qwen2#28436
Conversation
Update dummy_tokenizers_objects.py
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
ArthurZucker
left a comment
There was a problem hiding this comment.
LGTM! My only concern is that the normal attention layer does not use the new argument (max_window_layers, so results might differ between that and the Qwen2FlashAttention2 layer)
| # We need to at least pass vocab_file and merges_file to base class | ||
| # in case a slow tokenizer needs to be initialized; other can be | ||
| # configured through files |
There was a problem hiding this comment.
I think we should also define the extra tokens here as well 😉
copying the way we init them in the slow one!
| return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim) | ||
|
|
||
|
|
||
| class Qwen2Attention(nn.Module): |
There was a problem hiding this comment.
this attention class will not really support the max_swa_layers as it only uses the attention mask to perform sliced attention I doubt that it will have the same results no?
There was a problem hiding this comment.
Warning added for not using flash attention.
ArthurZucker
left a comment
There was a problem hiding this comment.
Alright, just a final nit on the tokenizer and I think we can merge!
(doc + unk_token for fast)
Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
|
Thanks a lot for this pr and bearing with me! 🤗 |
|
SDPA & eager implem don't seem to match on main (5c341d4), even when not using an attn_mask: |
|
cc @JustinLin610 have you tested both code paths? |
|
Hi, Can I use it on qwen1? If not, how can I adapt it to qwen1? Thank you! |
|
@JustinLin610 In the tests, Currently, this kind implies there is no integration tests (being run) at all when this model was added to |
|
I'll fix the code paths. Previously we have tested it and passed all the test. However, we had name changes and caused troubles. Sry about this. |
https://huggingface.co/Qwen/Qwen1.5-0.5B This is the one that corresponds to the original |
This is strange to me btw as this part of code is exactly copied from the mistral impl. |
No, you can't use it directly btw. You need to transform the state dict for the adaptation |
| merges_file, | ||
| errors="replace", | ||
| unk_token="<|endoftext|>", | ||
| bos_token=None, |
There was a problem hiding this comment.
Cross-posting from slack: is it expected that qwen1.5/qwen1.5-moe models have bos_token_id in their config.json, but not in tokenizer_config.json, while bos_token defaults to None in the tokenizer class?
This results in a loaded tokenizer not having a BOS token and I wonder if this is intendedcc @Giuseppe5


Adding Qwen2
This PR adds the support of codes for the coming Qwen2 models. For information about Qwen, please visit https://github.com/QwenLM/Qwen. @ArthurZucker