Spaces:
Running
Running
JaphetHernandez
commited on
Commit
•
105c4c8
1
Parent(s):
fa5dfea
Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ tokenizer.pad_token = tokenizer.eos_token
|
|
19 |
# Definir longitud máxima de tokens
|
20 |
MAX_INPUT_TOKEN_LENGTH = 4096
|
21 |
|
22 |
-
def generate_response(input_text, temperature=0.
|
23 |
"""Función de generación de texto con el modelo."""
|
24 |
input_ids = tokenizer.encode(input_text, return_tensors='pt')
|
25 |
input_ids = input_ids.to(model.device)
|
@@ -30,7 +30,7 @@ def generate_response(input_text, temperature=0.7, max_new_tokens=50):
|
|
30 |
streamer=streamer,
|
31 |
max_new_tokens=max_new_tokens,
|
32 |
do_sample=temperature != 0,
|
33 |
-
top_k=
|
34 |
top_p=0.9, # Considera solo el 90% de la probabilidad acumulada
|
35 |
temperature=temperature,
|
36 |
eos_token_id=[tokenizer.eos_token_id]
|
@@ -61,10 +61,8 @@ def main():
|
|
61 |
st.write(df.head()) # Mostrar las primeras filas del dataframe
|
62 |
job_titles = df['job_title'].tolist()
|
63 |
# Prompt inicial
|
64 |
-
initial_prompt =
|
65 |
-
|
66 |
-
"""
|
67 |
-
)
|
68 |
st.write(f"Query: {query}")
|
69 |
st.write(f"Prompt inicial: {initial_prompt}")
|
70 |
|
|
|
19 |
# Definir longitud máxima de tokens
|
20 |
MAX_INPUT_TOKEN_LENGTH = 4096
|
21 |
|
22 |
+
def generate_response(input_text, temperature=0.2, max_new_tokens=50):
|
23 |
"""Función de generación de texto con el modelo."""
|
24 |
input_ids = tokenizer.encode(input_text, return_tensors='pt')
|
25 |
input_ids = input_ids.to(model.device)
|
|
|
30 |
streamer=streamer,
|
31 |
max_new_tokens=max_new_tokens,
|
32 |
do_sample=temperature != 0,
|
33 |
+
top_k=10, # Limita las palabras más probables a 50
|
34 |
top_p=0.9, # Considera solo el 90% de la probabilidad acumulada
|
35 |
temperature=temperature,
|
36 |
eos_token_id=[tokenizer.eos_token_id]
|
|
|
61 |
st.write(df.head()) # Mostrar las primeras filas del dataframe
|
62 |
job_titles = df['job_title'].tolist()
|
63 |
# Prompt inicial
|
64 |
+
initial_prompt = f"I have a list of job titles: {job_titles}. Please give me the first job title from the list."
|
65 |
+
|
|
|
|
|
66 |
st.write(f"Query: {query}")
|
67 |
st.write(f"Prompt inicial: {initial_prompt}")
|
68 |
|