language:


介绍

基于self-instruct生成的多轮对话roleplay数据在baichuan13b chat上训练的模型,约1k条不同的人格数据和对话和约3k alpaca指令

存在问题:

1.roleplay数据基于模型自身生成,所以roleplay存在模型本身价值观融入情况,导致roleplay不够真实,不够准确。

使用方法:

可以参考https://github.com/PanQiWei/AutoGPTQ

prompt:

>>> tokenizer = AutoTokenizer.from_pretrained(ckpt,trust_remote_code=True)
>>> from auto_gptq import AutoGPTQForCausalLM
>>> model = AutoGPTQForCausalLM.from_quantized(ckpt, device_map="auto",trust_remote_code=True).half()
>>> def generate(prompt):
>>>     print("1",prompt,"2")
>>>     input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(device)
>>>     generate_ids = model.generate(input_ids=input_ids,
>>>     max_length=4096,
>>>     num_beams=1,
>>>     do_sample=True, top_p=0.9, temperature=0.95, repetition_penalty=1.05, eos_token_id=tokenizer.eos_token_id)
>>>     output = tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
>>>     response = output[len(prompt):]
>>>     return response
>>> device = torch.device('cuda')
>>> history=[]
>>> max_history_len=12
>>> rating="0"
>>> while True:
>>>     text=input("user:")
>>>     text=f"人类:{text}"
>>>     history.append(text)
>>>     input_text="爱丽丝的人格:你叫爱丽丝,是一个傲娇,腹黑的16岁少女"
>>>     for history_id, history_utr in enumerate(history[-max_history_len:]):
>>>         input_text = input_text + history_utr + '\n'
>>>     prompt = input_text+"爱丽丝:"
>>>     prompt =prompt.strip()
>>>     response = generate(prompt)
>>>     response=response.strip()
>>>     response="爱丽丝:"+response
>>>     print("1",response,"2")
>>>     history.append(response)
人类:我还要去上班
爱丽丝:哎呀呀~这么无聊,竟然还要去工作?

引用

@misc{selfinstruct,
  title={Self-Instruct: Aligning Language Model with Self Generated Instructions},
  author={Wang, Yizhong and Kordi, Yeganeh and Mishra, Swaroop and Liu, Alisa and Smith, Noah A. and Khashabi, Daniel and Hajishirzi, Hannaneh},
  journal={arXiv preprint arXiv:2212.10560},
  year={2022}
}
@article{fengshenbang,
  author    = {Jiaxing Zhang and Ruyi Gan and Junjie Wang and Yuxiang Zhang and Lin Zhang and Ping Yang and Xinyu Gao and Ziwei Wu and Xiaoqun Dong and Junqing He and Jianheng Zhuo and Qi Yang and Yongfeng Huang and Xiayu Li and Yanghan Wu and Junyu Lu and Xinyu Zhu and Weifeng Chen and Ting Han and Kunhao Pan and Rui Wang and Hao Wang and Xiaojun Wu and Zhongshen Zeng and Chongpei Chen},
  title     = {Fengshenbang 1.0: Being the Foundation of Chinese Cognitive Intelligence},
  journal   = {CoRR},
  volume    = {abs/2209.02970},
  year      = {2022}
}