Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,9 +2,18 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
tokenizer.padding_side = 'left'
|
7 |
-
model =
|
8 |
|
9 |
class ChatBot:
|
10 |
def __init__(self):
|
|
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
|
5 |
+
base_model = AutoModelForCausalLM.from_pretrained(
|
6 |
+
Mistral, # Mistral, same as before
|
7 |
+
quantization_config=bnb_config, # Same quantization config as before
|
8 |
+
device_map="auto",
|
9 |
+
trust_remote_code=True,
|
10 |
+
use_auth_token=api_token
|
11 |
+
)
|
12 |
+
|
13 |
+
tokenizer = AutoTokenizer.from_pretrained(base_model_id, trust_remote_code=True)
|
14 |
+
tokenizer.pad_token = tokenizer.eos_tokentokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.1")
|
15 |
tokenizer.padding_side = 'left'
|
16 |
+
model = PeftModel.from_pretrained(base_model, "Tonic/mistralmed")
|
17 |
|
18 |
class ChatBot:
|
19 |
def __init__(self):
|