Text Generation
Transformers
Safetensors
Chinese
English
qwen
conversational
custom_code
File size: 827 Bytes
c1d7064
 
be18b24
 
 
c1d7064
be18b24
d484906
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
---
license: cc-by-nc-4.0
language:
- zh
- en
---
* 将Qwen模型的NTK插值方法替换为Yarn,同时修改插值的程度,实现模型在更长文本长度(大于16k)下的正常对话能力。
* 目前仅提供  modeling_qwen.py  代码,用此py文件替换原Qwen模型的modeling_qwen.py即可,其它使用方法不变。模型权重与原Qwen模型相同。
* 未来可能会发布微调的权重。
* 使用时请务必设置  config.use_logn_attn=False、config.use_dynamic_ntk=True,否则模型能力会受影响。
```python
config=AutoConfig.from_pretrained("Qwen/Qwen-14B-Chat", trust_remote_code=True,use_dynamic_ntk=True,use_logn_attn=False,torch_dtype=torch.bfloat16)
model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-14B-Chat", device_map="auto", trust_remote_code=True,config=config)
  ```