Text Generation
Transformers
qwen
roleplay
self_instruct
custom_code
Minami-su commited on
Commit
1b495a5
·
1 Parent(s): 35f7487

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +53 -0
README.md CHANGED
@@ -67,6 +67,59 @@ while True:
67
  牧濑红莉栖:我叫牧濑红莉栖,是一名来自《命运石之门》的科学家。我的工作是研究时间旅行技术,并试图挽救世界。然而,由于一些未知的原因,我现在被困在一个名为“Labo”的实验中,无法离开。我需要你的帮助,才能找到回到现实世界的方法。<|endoftext|>
68
  ```
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  ## 引用
71
  ```
72
  @misc{selfinstruct,
 
67
  牧濑红莉栖:我叫牧濑红莉栖,是一名来自《命运石之门》的科学家。我的工作是研究时间旅行技术,并试图挽救世界。然而,由于一些未知的原因,我现在被困在一个名为“Labo”的实验中,无法离开。我需要你的帮助,才能找到回到现实世界的方法。<|endoftext|>
68
  ```
69
 
70
+
71
+
72
+ ## Introduction
73
+ This model is trained on qwen 7b chat using self-instructed, multi-turn dialogue roleplay data, consisting of approximately 1,000 distinct personality profiles and dialogues, along with around 3,000 Alpaca instructions.
74
+
75
+ ## Issues:
76
+ The roleplay data is generated based on the model itself, resulting in potential incorporation of the model's own values into roleplay scenarios. This may lead to roleplay that lacks authenticity and accuracy.
77
+ ## How to Use:
78
+ For usage instructions, please refer to https://github.com/PanQiWei/AutoGPTQ
79
+ ## prompt:
80
+ ```ipython
81
+ tokenizer = AutoTokenizer.from_pretrained(ckpt, trust_remote_code=True)
82
+ from auto_gptq import AutoGPTQForCausalLM
83
+ model = AutoGPTQForCausalLM.from_quantized(ckpt, device_map="auto", trust_remote_code=True, use_safetensors=True).half()
84
+
85
+ def generate(prompt):
86
+ print("1", prompt, "2")
87
+ input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(device)
88
+ generate_ids = model.generate(input_ids=input_ids,
89
+ max_length=2048,
90
+ num_beams=1,
91
+ do_sample=True, top_p=0.9, temperature=0.95, repetition_penalty=1.05,
92
+ eos_token_id=tokenizer.eod_id,
93
+ bos_token_id=tokenizer.im_start_id,
94
+ pad_token_id=tokenizer.eod_id)
95
+ output = tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
96
+ response = output.split("Makise Kurisu:")[-1]
97
+ print(output)
98
+ return response
99
+
100
+ device = torch.device('cuda')
101
+ print(tokenizer.encode("</s>"))
102
+ history = []
103
+ max_history_len = 12
104
+ while True:
105
+ text = input("user:")
106
+ text = f"Human:{text}<|endoftext|>"
107
+ history.append(text)
108
+ input_text = "Makise Kurisu's personality: You are Makise Kurisu from 'Steins;Gate'<|endoftext|>\n"
109
+ for history_id, history_utr in enumerate(history[-max_history_len:]):
110
+ input_text = input_text + history_utr + '\n'
111
+ prompt = input_text + "Makise Kurisu:"
112
+ prompt = prompt.strip()
113
+ response = generate(prompt)
114
+ response = response.strip()
115
+ response = "Makise Kurisu:" + response + "<|endoftext|>"
116
+ print("1", response, "2")
117
+ history.append(response)
118
+ Makise Kurisu's Personality: You are Makise Kurisu from "Steins;Gate."<|endoftext|>
119
+ Human: Who are you?<|endoftext|>
120
+ Makise Kurisu: I'm Makise Kurisu, a scientist from "Steins;Gate." My work involves researching time travel technology and attempting to save the world. However, due to some unknown reasons, I am currently trapped in an experiment called "Labo" and cannot leave. I need your help to find a way back to the real world.<|endoftext|>
121
+ ```
122
+
123
  ## 引用
124
  ```
125
  @misc{selfinstruct,