Update README.md
Browse files
README.md
CHANGED
@@ -28,10 +28,11 @@ open_llama_7b_v2_vicuna_Chinese is a chat model supervised finetuned on vicuna s
|
|
28 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
29 |
|
30 |
tokenizer = AutoTokenizer.from_pretrained("PengQu/open_llama_7b_v2_vicuna_Chinese",use_fast=False)
|
31 |
-
model = AutoModelForCausalLM.from_pretrained("PengQu/open_llama_7b_v2_vicuna_Chinese").to("cuda
|
32 |
|
33 |
-
|
34 |
-
|
|
|
35 |
|
36 |
generation_output = model.generate(input_ids=input_ids, max_new_tokens=512)
|
37 |
print(tokenizer.decode(generation_output[0],skip_special_tokens=True))
|
|
|
28 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
29 |
|
30 |
tokenizer = AutoTokenizer.from_pretrained("PengQu/open_llama_7b_v2_vicuna_Chinese",use_fast=False)
|
31 |
+
model = AutoModelForCausalLM.from_pretrained("PengQu/open_llama_7b_v2_vicuna_Chinese").to("cuda")
|
32 |
|
33 |
+
instruction = "A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: {} ASSISTANT:"
|
34 |
+
prompt = instruction.format('用flask写一个简单的http服务器。')
|
35 |
+
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to("cuda")
|
36 |
|
37 |
generation_output = model.generate(input_ids=input_ids, max_new_tokens=512)
|
38 |
print(tokenizer.decode(generation_output[0],skip_special_tokens=True))
|