Spaces:
Runtime error
Runtime error
cambiar a español
Browse files
app.py
CHANGED
@@ -5,14 +5,18 @@ import torch.nn.functional as F
|
|
5 |
import pandas as pd
|
6 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
7 |
|
8 |
-
tokenizer
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
11 |
@solara.component
|
12 |
def Page():
|
13 |
with solara.Column(margin=10):
|
14 |
-
solara.Markdown("#
|
15 |
-
solara.Markdown("
|
16 |
def on_action_cell(column, row_index):
|
17 |
text1.value += tokenizer.decode(top_10.indices[0][row_index])
|
18 |
cell_actions = [solara.CellAction(icon="mdi-thumb-up", name="Select", on_click=on_action_cell)]
|
|
|
5 |
import pandas as pd
|
6 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
7 |
|
8 |
+
# Cargar el tokenizer y el modelo preentrenado en español
|
9 |
+
tokenizer = AutoTokenizer.from_pretrained("datificate/gpt2-small-spanish")
|
10 |
+
model = AutoModelForCausalLM.from_pretrained("datificate/gpt2-small-spanish")
|
11 |
+
|
12 |
+
# tokenizer = AutoTokenizer.from_pretrained('gpt2')
|
13 |
+
# model = AutoModelForCausalLM.from_pretrained('gpt2')
|
14 |
+
text1 = solara.reactive("Hola, ¿cómo estás")
|
15 |
@solara.component
|
16 |
def Page():
|
17 |
with solara.Column(margin=10):
|
18 |
+
solara.Markdown("#Siguiente token prediction ")
|
19 |
+
solara.Markdown("Hemos creado esta herramienta para entender el funcionamiento de los modelos de lenguage autoregresivos... ")
|
20 |
def on_action_cell(column, row_index):
|
21 |
text1.value += tokenizer.decode(top_10.indices[0][row_index])
|
22 |
cell_actions = [solara.CellAction(icon="mdi-thumb-up", name="Select", on_click=on_action_cell)]
|