Sabbah13 commited on
Commit
a1bc2d7
1 Parent(s): f107f2d

Update qwen.py

Browse files
Files changed (1) hide show
  1. qwen.py +11 -0
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
  ):