Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
3 |
-
import torch
|
4 |
|
5 |
# Cargar el tokenizer del modelo base
|
6 |
tokenizer = AutoTokenizer.from_pretrained("unsloth/meta-llama-3.1-8b-bnb-4bit")
|
7 |
|
8 |
-
# Cargar el modelo base sin 4-bit
|
9 |
-
model = AutoModelForCausalLM.from_pretrained("unsloth/meta-llama-3.1-8b-bnb-4bit")
|
10 |
|
11 |
# Cargar el adaptador LoRA
|
12 |
model.load_adapter("JuanCabs/lapepav1", source="hf")
|
@@ -25,4 +24,3 @@ interface = gr.Interface(fn=generar_respuesta, inputs="text", outputs="text",
|
|
25 |
# Lanzar la aplicaci贸n en Hugging Face Spaces
|
26 |
if __name__ == "__main__":
|
27 |
interface.launch()
|
28 |
-
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
3 |
|
4 |
# Cargar el tokenizer del modelo base
|
5 |
tokenizer = AutoTokenizer.from_pretrained("unsloth/meta-llama-3.1-8b-bnb-4bit")
|
6 |
|
7 |
+
# Cargar el modelo base sin usar bitsandbytes ni 4-bit
|
8 |
+
model = AutoModelForCausalLM.from_pretrained("unsloth/meta-llama-3.1-8b-bnb-4bit", device_map="cpu")
|
9 |
|
10 |
# Cargar el adaptador LoRA
|
11 |
model.load_adapter("JuanCabs/lapepav1", source="hf")
|
|
|
24 |
# Lanzar la aplicaci贸n en Hugging Face Spaces
|
25 |
if __name__ == "__main__":
|
26 |
interface.launch()
|
|