Update README.md
Browse files
README.md
CHANGED
@@ -64,8 +64,22 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
64 |
model.generation_config.pad_token_id = tokenizer.eos_token_id
|
65 |
|
66 |
# Inference simple as transformers library
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
inputs.to(device)
|
70 |
|
71 |
with torch.inference_mode:
|
|
|
64 |
model.generation_config.pad_token_id = tokenizer.eos_token_id
|
65 |
|
66 |
# Inference simple as transformers library
|
67 |
+
messages = [
|
68 |
+
{
|
69 |
+
"role": "system",
|
70 |
+
"content": "You are a search bot, answer on user text queries."
|
71 |
+
},
|
72 |
+
{
|
73 |
+
"role": "user",
|
74 |
+
"content": "Describe basics of DNNs quantization."
|
75 |
+
}
|
76 |
+
]
|
77 |
+
|
78 |
+
chat_prompt = tokenizer.apply_chat_template(
|
79 |
+
messages, add_generation_prompt=True, tokenize=False
|
80 |
+
)
|
81 |
+
|
82 |
+
inputs = tokenizer(chat_prompt, return_tensors="pt")
|
83 |
inputs.to(device)
|
84 |
|
85 |
with torch.inference_mode:
|