Update app.py
Browse files
app.py
CHANGED
@@ -1,20 +1,16 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
4 |
|
5 |
# Configuraci贸n del modelo
|
6 |
model_id = "somosnlp-hackathon-2025/leia_preference_model_social_norms"
|
7 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
8 |
|
9 |
-
# Config vac铆a para evitar errores de quantizaci贸n
|
10 |
-
quant_config = BitsAndBytesConfig(load_in_4bit=False, load_in_8bit=False)
|
11 |
|
12 |
# Cargar modelo y tokenizer
|
13 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
14 |
-
model = AutoModelForCausalLM.from_pretrained(
|
15 |
-
|
16 |
-
quantization_config=quant_config
|
17 |
-
).to(device)
|
18 |
|
19 |
# Funci贸n para responder
|
20 |
def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
4 |
|
5 |
# Configuraci贸n del modelo
|
6 |
model_id = "somosnlp-hackathon-2025/leia_preference_model_social_norms"
|
7 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
8 |
|
|
|
|
|
9 |
|
10 |
# Cargar modelo y tokenizer
|
11 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
12 |
+
model = AutoModelForCausalLM.from_pretrained(model_id).to(device)
|
13 |
+
|
|
|
|
|
14 |
|
15 |
# Funci贸n para responder
|
16 |
def respond(message, history, system_message, max_tokens, temperature, top_p):
|