Qwen
/

yangapku commited on
Commit
29cbdb2
·
1 Parent(s): db7483f

update configs

Browse files
Files changed (3) hide show
  1. config.json +1 -1
  2. generation_config.json +2 -1
  3. modeling_qwen.py +8 -2
config.json CHANGED
@@ -23,7 +23,7 @@
23
  "n_embd": 4096,
24
  "n_head": 32,
25
  "n_layer": 32,
26
- "n_positions": 6144,
27
  "no_bias": true,
28
  "onnx_safe": null,
29
  "padded_vocab_size": 151936,
 
23
  "n_embd": 4096,
24
  "n_head": 32,
25
  "n_layer": 32,
26
+ "n_positions": 8192,
27
  "no_bias": true,
28
  "onnx_safe": null,
29
  "padded_vocab_size": 151936,
generation_config.json CHANGED
@@ -1,8 +1,9 @@
1
  {
2
  "chat_format": "chatml",
3
  "eos_token_id": 151643,
4
- "max_new_tokens": 512,
5
  "pad_token_id": 151643,
 
 
6
  "do_sample": true,
7
  "top_k": 0,
8
  "top_p": 0.5,
 
1
  {
2
  "chat_format": "chatml",
3
  "eos_token_id": 151643,
 
4
  "pad_token_id": 151643,
5
+ "max_window_size": 6144,
6
+ "max_new_tokens": 512,
7
  "do_sample": true,
8
  "top_k": 0,
9
  "top_p": 0.5,
modeling_qwen.py CHANGED
@@ -994,12 +994,15 @@ class QWenLMHeadModel(QWenPreTrainedModel):
994
  if stop_words_ids is None:
995
  stop_words_ids = []
996
 
 
 
 
997
  raw_text, context_tokens = make_context(
998
  tokenizer,
999
  query,
1000
  history=history,
1001
  system=system,
1002
- max_window_size=6144,
1003
  chat_format=self.generation_config.chat_format,
1004
  )
1005
 
@@ -1045,12 +1048,15 @@ class QWenLMHeadModel(QWenPreTrainedModel):
1045
  if stop_words_ids is None:
1046
  stop_words_ids = []
1047
 
 
 
 
1048
  raw_text, context_tokens = make_context(
1049
  tokenizer,
1050
  query,
1051
  history=history,
1052
  system=system,
1053
- max_window_size=6144,
1054
  chat_format=self.generation_config.chat_format,
1055
  )
1056
 
 
994
  if stop_words_ids is None:
995
  stop_words_ids = []
996
 
997
+ max_window_size = kwargs.get('max_window_size', None)
998
+ if max_window_size is None:
999
+ max_window_size = self.generation_config.max_window_size
1000
  raw_text, context_tokens = make_context(
1001
  tokenizer,
1002
  query,
1003
  history=history,
1004
  system=system,
1005
+ max_window_size=max_window_size,
1006
  chat_format=self.generation_config.chat_format,
1007
  )
1008
 
 
1048
  if stop_words_ids is None:
1049
  stop_words_ids = []
1050
 
1051
+ max_window_size = kwargs.get('max_window_size', None)
1052
+ if max_window_size is None:
1053
+ max_window_size = self.generation_config.max_window_size
1054
  raw_text, context_tokens = make_context(
1055
  tokenizer,
1056
  query,
1057
  history=history,
1058
  system=system,
1059
+ max_window_size=max_window_size,
1060
  chat_format=self.generation_config.chat_format,
1061
  )
1062