Spaces:
Runtime error
Runtime error
FlawedLLM
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -5,10 +5,20 @@ import re
|
|
5 |
import spaces
|
6 |
import gradio as gr
|
7 |
import torch
|
8 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM
|
9 |
|
10 |
-
tokenizer = AutoTokenizer.from_pretrained("FlawedLLM/Bhashini_gemma_merged4bit_clean_final")
|
11 |
-
model = AutoModelForCausalLM.from_pretrained("FlawedLLM/Bhashini_gemma_merged4bit_clean_final", load_in_4bit=True, device_map="auto")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
# alpaca_prompt = You MUST copy from above!
|
14 |
@spaces.GPU(duration=300)
|
|
|
5 |
import spaces
|
6 |
import gradio as gr
|
7 |
import torch
|
8 |
+
# from transformers import AutoTokenizer, AutoModelForCausalLM
|
9 |
|
10 |
+
# tokenizer = AutoTokenizer.from_pretrained("FlawedLLM/Bhashini_gemma_merged4bit_clean_final")
|
11 |
+
# model = AutoModelForCausalLM.from_pretrained("FlawedLLM/Bhashini_gemma_merged4bit_clean_final", load_in_4bit=True, device_map="auto")
|
12 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
13 |
+
from peft import PeftModel
|
14 |
+
|
15 |
+
# 1. Load Your Base Model and LoRA Adapter
|
16 |
+
model_name_or_path = "FlawedLLM/Bhashini_gemma_merged4bit_clean_final" # Hugging Face model or local path
|
17 |
+
lora_weights = "FlawedLLM/Bhashini_gemma_lora_clean_final" # LoRA weights
|
18 |
+
|
19 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
|
20 |
+
model = AutoModelForCausalLM.from_pretrained(model_name_or_path, load_in_8bit=True, device_map='auto')
|
21 |
+
model = PeftModel.from_pretrained(model, lora_weights)
|
22 |
|
23 |
# alpaca_prompt = You MUST copy from above!
|
24 |
@spaces.GPU(duration=300)
|