Update qwen.py
Browse files
qwen.py
CHANGED
@@ -1,3 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
def respond(
|
2 |
message,
|
3 |
):
|
|
|
1 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig
|
2 |
+
|
3 |
+
device = "cuda" # the device to load the model onto
|
4 |
+
|
5 |
+
model = AutoModelForCausalLM.from_pretrained(
|
6 |
+
"Qwen/Qwen2-7B-Instruct",
|
7 |
+
torch_dtype="auto",
|
8 |
+
device_map="auto"
|
9 |
+
)
|
10 |
+
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2-7B-Instruct")
|
11 |
+
|
12 |
def respond(
|
13 |
message,
|
14 |
):
|