Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,15 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM,
|
4 |
|
|
|
5 |
base_model_id = "mistralai/Mistral-7B-v0.1"
|
6 |
-
|
7 |
-
load_in_4bit=True,
|
8 |
-
bnb_4bit_use_double_quant=True,
|
9 |
-
bnb_4bit_quant_type="nf4",
|
10 |
-
bnb_4bit_compute_dtype=torch.bfloat16
|
11 |
-
)
|
12 |
|
13 |
# Load the fine-tuned model "Tonic/mistralmed"
|
14 |
-
model = AutoModelForCausalLM.from_pretrained("Tonic/mistralmed",
|
15 |
|
16 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
17 |
tokenizer.pad_token = tokenizer.eos_token
|
18 |
tokenizer.padding_side = 'left'
|
19 |
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, AutoConfig
|
4 |
|
5 |
+
# Use the base model's ID and configuration
|
6 |
base_model_id = "mistralai/Mistral-7B-v0.1"
|
7 |
+
config = AutoConfig.from_pretrained(base_model_id)
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
# Load the fine-tuned model "Tonic/mistralmed"
|
10 |
+
model = AutoModelForCausalLM.from_pretrained("Tonic/mistralmed", config=config)
|
11 |
|
12 |
+
tokenizer = AutoTokenizer.from_pretrained(base_model_id, trust_remote_code=True)
|
13 |
tokenizer.pad_token = tokenizer.eos_token
|
14 |
tokenizer.padding_side = 'left'
|
15 |
|