Tonic commited on
Commit
8dcd0f1
1 Parent(s): 63a0917

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -48,9 +48,8 @@ def multimodal_prompt(user_input, system_prompt="You are an expert medical analy
48
  tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.1", trust_remote_code=True, padding_side="left")
49
  tokenizer.pad_token = tokenizer.eos_token
50
  tokenizer.padding_side = 'left'
51
-
52
  peft_config = PeftConfig.from_pretrained("Tonic/mistralmed")
53
- peft_model = MistralForCausalLM.from_pretrained("mistralai/Mistral-7B-v0.1", trust_remote_code=True)
54
  peft_model = PeftModel.from_pretrained(peft_model, "Tonic/mistralmed")
55
  peft_model = peft_model.to(torch.bfloat16)
56
  peft_model = peft_model.to(device)
@@ -63,7 +62,7 @@ class ChatBot:
63
  def __init__(self):
64
  self.history = []
65
 
66
- def predict(self, user_input, system_prompt="You are an expert medical analyst:"):
67
  formatted_input = f"<s>[INST]{system_prompt} {user_input}[/INST]"
68
  user_input_ids = tokenizer.encode(formatted_input, return_tensors="pt")
69
  user_input_ids = user_input_ids.to(device)
 
48
  tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.1", trust_remote_code=True, padding_side="left")
49
  tokenizer.pad_token = tokenizer.eos_token
50
  tokenizer.padding_side = 'left'
 
51
  peft_config = PeftConfig.from_pretrained("Tonic/mistralmed")
52
+ peft_model = MistralForCausalLM.from_pretrained("mistralai/Mistral-7B-v0.1")
53
  peft_model = PeftModel.from_pretrained(peft_model, "Tonic/mistralmed")
54
  peft_model = peft_model.to(torch.bfloat16)
55
  peft_model = peft_model.to(device)
 
62
  def __init__(self):
63
  self.history = []
64
 
65
+ def predict(self, user_input, system_prompt="You are an expert medical analyst:"):
66
  formatted_input = f"<s>[INST]{system_prompt} {user_input}[/INST]"
67
  user_input_ids = tokenizer.encode(formatted_input, return_tensors="pt")
68
  user_input_ids = user_input_ids.to(device)