Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ import os
|
|
11 |
#sft_model = "somosnlp/gemma-FULL-RAC-Colombia_v2"
|
12 |
#sft_model = "somosnlp/RecetasDeLaAbuela_mistral-7b-instruct-v0.2-bnb-4bit"
|
13 |
#base_model_name = "unsloth/Mistral-7B-Instruct-v0.2"
|
14 |
-
|
15 |
sft_model2 = "somosnlp/RecetasDeLaAbuela_mistral-7b-instruct-v0.2-bnb-4bit"
|
16 |
base_model_name = "unsloth/gemma-2b-it-bnb-4bit"
|
17 |
|
@@ -34,7 +34,7 @@ base_model = AutoModelForCausalLM.from_pretrained(base_model_name,return_dict=Tr
|
|
34 |
#base_model = AutoModelForCausalLM.from_pretrained(base_model_name, return_dict=True, device_map = {"":0}, attn_implementation = attn_implementation,).eval()
|
35 |
|
36 |
tokenizer = AutoTokenizer.from_pretrained(base_model_name, max_length = max_seq_length)
|
37 |
-
ft_model = PeftModel.from_pretrained(base_model,
|
38 |
model = ft_model.merge_and_unload()
|
39 |
model.save_pretrained(".")
|
40 |
#model.to('cuda')
|
@@ -103,11 +103,11 @@ mis_ejemplos = [
|
|
103 |
["¿Como se cocinan unos autenticos frijoles?"],
|
104 |
]
|
105 |
|
106 |
-
lista_modelos = [
|
107 |
|
108 |
iface = gr.Interface(
|
109 |
fn=mostrar_respuesta,
|
110 |
-
inputs=[gr.Dropdown(lista_modelos, value =
|
111 |
gr.Textbox(label="Pregunta"),
|
112 |
gr.Textbox(label="Contexto", value="You are a helpful AI assistant. Eres un experto cocinero hispanoamericano."),],
|
113 |
outputs=[gr.Textbox(label="Respuesta", lines=2),],
|
|
|
11 |
#sft_model = "somosnlp/gemma-FULL-RAC-Colombia_v2"
|
12 |
#sft_model = "somosnlp/RecetasDeLaAbuela_mistral-7b-instruct-v0.2-bnb-4bit"
|
13 |
#base_model_name = "unsloth/Mistral-7B-Instruct-v0.2"
|
14 |
+
sft_model1 = "somosnlp/RecetasDeLaAbuela_gemma-2b-it-bnb-4bit"
|
15 |
sft_model2 = "somosnlp/RecetasDeLaAbuela_mistral-7b-instruct-v0.2-bnb-4bit"
|
16 |
base_model_name = "unsloth/gemma-2b-it-bnb-4bit"
|
17 |
|
|
|
34 |
#base_model = AutoModelForCausalLM.from_pretrained(base_model_name, return_dict=True, device_map = {"":0}, attn_implementation = attn_implementation,).eval()
|
35 |
|
36 |
tokenizer = AutoTokenizer.from_pretrained(base_model_name, max_length = max_seq_length)
|
37 |
+
ft_model = PeftModel.from_pretrained(base_model, sft_model1)
|
38 |
model = ft_model.merge_and_unload()
|
39 |
model.save_pretrained(".")
|
40 |
#model.to('cuda')
|
|
|
103 |
["¿Como se cocinan unos autenticos frijoles?"],
|
104 |
]
|
105 |
|
106 |
+
lista_modelos = [sft_model1, sft_model2]
|
107 |
|
108 |
iface = gr.Interface(
|
109 |
fn=mostrar_respuesta,
|
110 |
+
inputs=[gr.Dropdown(choices=lista_modelos, value = sft_model1, label="Modelo", type="value"),
|
111 |
gr.Textbox(label="Pregunta"),
|
112 |
gr.Textbox(label="Contexto", value="You are a helpful AI assistant. Eres un experto cocinero hispanoamericano."),],
|
113 |
outputs=[gr.Textbox(label="Respuesta", lines=2),],
|