ragerri commited on
Commit
1262c59
1 Parent(s): ef0804a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -1,10 +1,13 @@
1
- from transformers import AutoTokenizer, AutoModelForCausalLM
 
2
  import os
3
 
4
  access_token = os.environ['HF_TOKEN']
5
 
6
- tokenizer = AutoTokenizer.from_pretrained("HiTZ/Mistral-7B-MedExpQA-EN", token=access_token)
7
- model = AutoModelForCausalLM.from_pretrained("HiTZ/Mistral-7B-MedExpQA-EN", token=access_token)
 
 
8
 
9
  input_text = "Write me a poem about Machine Learning."
10
  input_ids = tokenizer(input_text, return_tensors="pt")
 
1
+ from peft import PeftModel, PeftConfig
2
+ from transformers import AutoModelForCausalLM
3
  import os
4
 
5
  access_token = os.environ['HF_TOKEN']
6
 
7
+ config = PeftConfig.from_pretrained("HiTZ/Mistral-7B-MedExpQA-EN")
8
+ model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-v0.1", token=access_token)
9
+ model = PeftModel.from_pretrained(model, "HiTZ/Mistral-7B-MedExpQA-EN", token=access_token)
10
+ tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.1", token=access_token)
11
 
12
  input_text = "Write me a poem about Machine Learning."
13
  input_ids = tokenizer(input_text, return_tensors="pt")