Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -71,3 +71,17 @@
|
|
| 71 |
# with open(c,"rb") as file:
|
| 72 |
# st.download_button(label=':blue[Download]',data=file,file_name=OP,mime="image/png")
|
| 73 |
# st.success("Thanks for using the app !!!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
# with open(c,"rb") as file:
|
| 72 |
# st.download_button(label=':blue[Download]',data=file,file_name=OP,mime="image/png")
|
| 73 |
# st.success("Thanks for using the app !!!")
|
| 74 |
+
|
| 75 |
+
import torch
|
| 76 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 77 |
+
|
| 78 |
+
torch.set_default_device("cuda")
|
| 79 |
+
|
| 80 |
+
model = AutoModelForCausalLM.from_pretrained("soulhq-ai/phi-2-insurance_qa-sft-lora", torch_dtype="auto", trust_remote_code=True)
|
| 81 |
+
tokenizer = AutoTokenizer.from_pretrained("soulhq-ai/phi-2-insurance_qa-sft-lora", trust_remote_code=True)
|
| 82 |
+
|
| 83 |
+
inputs = tokenizer('''### Instruction: What Does Basic Homeowners Insurance Cover?\n### Response: ''', return_tensors="pt", return_attention_mask=False)
|
| 84 |
+
|
| 85 |
+
outputs = model.generate(**inputs, max_length=1024)
|
| 86 |
+
text = tokenizer.batch_decode(outputs)[0]
|
| 87 |
+
print(text)
|