Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -33,7 +33,7 @@ def load_model(model_name):
|
|
33 |
|
34 |
return f"Modèle {model_name} chargé avec succès sur GPU."
|
35 |
|
36 |
-
def generate_text(input_text, temperature, top_p,
|
37 |
global model, tokenizer
|
38 |
|
39 |
inputs = tokenizer(input_text, return_tensors="pt", padding=True, truncation=True, max_length=512).to(model.device)
|
@@ -44,8 +44,9 @@ def generate_text(input_text, temperature, top_p, top_k):
|
|
44 |
max_new_tokens=50,
|
45 |
temperature=temperature,
|
46 |
top_p=top_p,
|
47 |
-
top_k=
|
48 |
output_attentions=True,
|
|
|
49 |
return_dict_in_generate=True
|
50 |
)
|
51 |
|
@@ -137,4 +138,4 @@ with gr.Blocks() as demo:
|
|
137 |
reset_button.click(reset,
|
138 |
outputs=[input_text, temperature, top_p, top_k, output_text, attention_plot, prob_plot])
|
139 |
|
140 |
-
demo.launch()
|
|
|
33 |
|
34 |
return f"Modèle {model_name} chargé avec succès sur GPU."
|
35 |
|
36 |
+
def generate_text(input_text, temperature, top_p, top_k_value):
|
37 |
global model, tokenizer
|
38 |
|
39 |
inputs = tokenizer(input_text, return_tensors="pt", padding=True, truncation=True, max_length=512).to(model.device)
|
|
|
44 |
max_new_tokens=50,
|
45 |
temperature=temperature,
|
46 |
top_p=top_p,
|
47 |
+
top_k=top_k_value,
|
48 |
output_attentions=True,
|
49 |
+
output_scores=True, # Activer les scores pour obtenir les logits
|
50 |
return_dict_in_generate=True
|
51 |
)
|
52 |
|
|
|
138 |
reset_button.click(reset,
|
139 |
outputs=[input_text, temperature, top_p, top_k, output_text, attention_plot, prob_plot])
|
140 |
|
141 |
+
demo.launch()
|