Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
import gradio as gr
|
2 |
from peft import PeftModel, PeftConfig
|
3 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
4 |
-
import
|
|
|
5 |
|
6 |
# Device configuration (prioritize GPU if available)
|
7 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
8 |
|
9 |
# Load models and tokenizer efficiently
|
10 |
-
|
11 |
-
config = PeftConfig.from_pretrained(model_id=model_id)
|
12 |
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
|
13 |
model = PeftModel.from_pretrained(model_id)
|
14 |
model.to(device)
|
|
|
1 |
import gradio as gr
|
2 |
from peft import PeftModel, PeftConfig
|
3 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
4 |
+
import
|
5 |
+
torch
|
6 |
|
7 |
# Device configuration (prioritize GPU if available)
|
8 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
9 |
|
10 |
# Load models and tokenizer efficiently
|
11 |
+
config = PeftConfig.from_pretrained("phearion/bigbrain-v0.0.1")
|
|
|
12 |
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
|
13 |
model = PeftModel.from_pretrained(model_id)
|
14 |
model.to(device)
|