Tonic commited on
Commit
bf9669d
•
1 Parent(s): 8cbf9d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -9,19 +9,19 @@ model_directory = "Tonic/mistralmed"
9
 
10
  # Instantiate the Models
11
  tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.1", trust_remote_code=True)
12
- tokenizer.pad_token = tokenizer.eos_token
13
- tokenizer.padding_side = 'left'
14
 
15
 
16
  # Specify the configuration class for the model
17
- model_config = AutoConfig.from_pretrained(base_model_id)
18
 
19
  # Load the PEFT model with the specified configuration
20
- peft_model = AutoModelForCausalLM.from_pretrained(base_model_id, config=model_config)
21
 
22
  # Load the PEFT model
23
  peft_config = PeftConfig.from_pretrained("Tonic/mistralmed", token="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")
24
- peft_model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-v0.1")
25
  peft_model = PeftModel.from_pretrained(base_model, "Tonic/mistralmed", token="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")
26
 
27
  class ChatBot:
@@ -42,7 +42,7 @@ class ChatBot:
42
  response = peft_model.generate(chat_history_ids, max_length=512, pad_token_id=tokenizer.eos_token_id)
43
 
44
  # Update chat history
45
- self.history = response
46
 
47
  # Decode and return the response
48
  response_text = tokenizer.decode(response[0], skip_special_tokens=True)
 
9
 
10
  # Instantiate the Models
11
  tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.1", trust_remote_code=True)
12
+ #tokenizer.pad_token = tokenizer.eos_token
13
+ #tokenizer.padding_side = 'left'
14
 
15
 
16
  # Specify the configuration class for the model
17
+ #model_config = AutoConfig.from_pretrained(base_model_id)
18
 
19
  # Load the PEFT model with the specified configuration
20
+ #peft_model = AutoModelForCausalLM.from_pretrained(base_model_id, config=model_config)
21
 
22
  # Load the PEFT model
23
  peft_config = PeftConfig.from_pretrained("Tonic/mistralmed", token="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")
24
+ peft_model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-v0.1", trust_remote_code=True)
25
  peft_model = PeftModel.from_pretrained(base_model, "Tonic/mistralmed", token="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")
26
 
27
  class ChatBot:
 
42
  response = peft_model.generate(chat_history_ids, max_length=512, pad_token_id=tokenizer.eos_token_id)
43
 
44
  # Update chat history
45
+ self.history = chat_history_ids
46
 
47
  # Decode and return the response
48
  response_text = tokenizer.decode(response[0], skip_special_tokens=True)