Tonic commited on
Commit
21d3f61
1 Parent(s): 881ce48

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -1,19 +1,15 @@
1
  import gradio as gr
2
  import torch
3
- from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
4
 
 
5
  base_model_id = "mistralai/Mistral-7B-v0.1"
6
- bnb_config = BitsAndBytesConfig(
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", quantization_config=bnb_config)
15
 
16
- tokenizer = AutoTokenizer.from_pretrained("Tonic/mistralmed", trust_remote_code=True)
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