Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,10 @@
|
|
1 |
import gradio as gr
|
2 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
3 |
|
4 |
-
#
|
5 |
-
quantization_config = BitsAndBytesConfig(load_in_8bit=True)
|
6 |
-
|
7 |
-
# Cargar el modelo usando la configuraci贸n de 8 bits
|
8 |
model = AutoModelForCausalLM.from_pretrained(
|
9 |
"JuanCabs/lapepav0",
|
10 |
-
|
11 |
-
device_map="auto" # Asignar autom谩ticamente el dispositivo CPU/GPU
|
12 |
)
|
13 |
tokenizer = AutoTokenizer.from_pretrained("JuanCabs/lapepav0")
|
14 |
|
@@ -23,8 +19,8 @@ interface = gr.Interface(
|
|
23 |
fn=generate_text, # Funci贸n que se ejecutar谩 cuando el usuario env铆e un prompt
|
24 |
inputs="text", # Entrada de texto
|
25 |
outputs="text", # Salida de texto
|
26 |
-
title="Text Generation with
|
27 |
-
description="Introduce un prompt para generar texto usando
|
28 |
)
|
29 |
|
30 |
# Lanzar la aplicaci贸n
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
3 |
|
4 |
+
# Cargar el modelo sin optimizaci贸n de 8 bits (usa m谩s memoria)
|
|
|
|
|
|
|
5 |
model = AutoModelForCausalLM.from_pretrained(
|
6 |
"JuanCabs/lapepav0",
|
7 |
+
device_map="auto" # Asigna autom谩ticamente el dispositivo CPU/GPU disponible
|
|
|
8 |
)
|
9 |
tokenizer = AutoTokenizer.from_pretrained("JuanCabs/lapepav0")
|
10 |
|
|
|
19 |
fn=generate_text, # Funci贸n que se ejecutar谩 cuando el usuario env铆e un prompt
|
20 |
inputs="text", # Entrada de texto
|
21 |
outputs="text", # Salida de texto
|
22 |
+
title="Text Generation with Model", # T铆tulo del Space
|
23 |
+
description="Introduce un prompt para generar texto usando el modelo" # Descripci贸n
|
24 |
)
|
25 |
|
26 |
# Lanzar la aplicaci贸n
|