Update README.md
Browse files
README.md
CHANGED
@@ -35,12 +35,10 @@ tokenizer = AutoTokenizer.from_pretrained("hiyouga/Qwen-14B-Chat-LLaMAfied")
|
|
35 |
model = AutoModelForCausalLM.from_pretrained("hiyouga/Qwen-14B-Chat-LLaMAfied", torch_dtype="auto", device_map="auto")
|
36 |
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
|
37 |
|
38 |
-
|
39 |
-
"
|
40 |
-
|
41 |
-
|
42 |
-
)
|
43 |
-
inputs = tokenizer([query], return_tensors="pt")
|
44 |
inputs = inputs.to("cuda")
|
45 |
generate_ids = model.generate(**inputs, eos_token_id=[151643, 151645], max_new_tokens=256, streamer=streamer)
|
46 |
```
|
|
|
35 |
model = AutoModelForCausalLM.from_pretrained("hiyouga/Qwen-14B-Chat-LLaMAfied", torch_dtype="auto", device_map="auto")
|
36 |
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
|
37 |
|
38 |
+
messages = [
|
39 |
+
{"role": "user", "content": "Who are you?"}
|
40 |
+
]
|
41 |
+
inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
|
|
|
|
|
42 |
inputs = inputs.to("cuda")
|
43 |
generate_ids = model.generate(**inputs, eos_token_id=[151643, 151645], max_new_tokens=256, streamer=streamer)
|
44 |
```
|