yasserrmd commited on
Commit
3857def
·
verified ·
1 Parent(s): 4c4dfc8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -5,18 +5,20 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
5
 
6
  # Load MedScholar model and tokenizer
7
  model_name = "yasserrmd/MedScholar-1.5B"
8
- tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
9
- model = AutoModelForCausalLM.from_pretrained(
10
- model_name,
11
- device_map="auto",
12
- torch_dtype=torch.float16,
13
- trust_remote_code=True
14
- )
15
- model.eval()
16
 
17
  # Chat function (streaming style)
18
  @spaces.GPU
19
  def respond(message, history: list[tuple[str, str]], system_message, max_tokens, temperature, top_p):
 
 
 
 
 
 
 
 
20
  # Prepare the full conversation
21
  conversation = [{"role": "system", "content": system_message}]
22
  for user_msg, bot_reply in history:
 
5
 
6
  # Load MedScholar model and tokenizer
7
  model_name = "yasserrmd/MedScholar-1.5B"
8
+
9
+
 
 
 
 
 
 
10
 
11
  # Chat function (streaming style)
12
  @spaces.GPU
13
  def respond(message, history: list[tuple[str, str]], system_message, max_tokens, temperature, top_p):
14
+ tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
15
+ model = AutoModelForCausalLM.from_pretrained(
16
+ model_name,
17
+ device_map="auto",
18
+ torch_dtype=torch.float16,
19
+ trust_remote_code=True
20
+ )
21
+ model.eval()
22
  # Prepare the full conversation
23
  conversation = [{"role": "system", "content": system_message}]
24
  for user_msg, bot_reply in history: