Change highlighting
Browse files
app.py
CHANGED
|
@@ -265,15 +265,12 @@ def diffusion_chat(question, max_it, pause_length, sharpness, clustering, noise_
|
|
| 265 |
noised_answer, just_noised_indices = confidence_guided_noising(
|
| 266 |
current_tokens, answer_start, confidences, noise_clipping, threshold=threshold, noise_start=noise_start
|
| 267 |
)
|
| 268 |
-
just_noised_indices = []
|
| 269 |
else:
|
| 270 |
noised_answer, just_noised_indices = noisify_answer(
|
| 271 |
current_tokens, answer_start, threshold=threshold, clustering=clustering, noise_start = noise_start,
|
| 272 |
)
|
| 273 |
|
| 274 |
-
# Compose full input again: prompt + noised answer
|
| 275 |
-
current_tokens = ori_input_tokens[:answer_start] + noised_answer[answer_start:]
|
| 276 |
-
|
| 277 |
# --- RED HIGHLIGHT ---
|
| 278 |
decoded_tokens = tokenizer.convert_ids_to_tokens(current_tokens[answer_start:])
|
| 279 |
highlighted = []
|
|
@@ -288,8 +285,11 @@ def diffusion_chat(question, max_it, pause_length, sharpness, clustering, noise_
|
|
| 288 |
else:
|
| 289 |
highlighted.append(token_str)
|
| 290 |
|
|
|
|
|
|
|
|
|
|
| 291 |
yield f"<b>Iteration {i+1}/{max_it} (before noising):</b><br>" + "".join(highlighted).replace('\n', '<br>')
|
| 292 |
-
time.sleep(pause_length)
|
| 293 |
|
| 294 |
|
| 295 |
answer_ids = current_tokens[answer_start:]
|
|
|
|
| 265 |
noised_answer, just_noised_indices = confidence_guided_noising(
|
| 266 |
current_tokens, answer_start, confidences, noise_clipping, threshold=threshold, noise_start=noise_start
|
| 267 |
)
|
| 268 |
+
# just_noised_indices = []
|
| 269 |
else:
|
| 270 |
noised_answer, just_noised_indices = noisify_answer(
|
| 271 |
current_tokens, answer_start, threshold=threshold, clustering=clustering, noise_start = noise_start,
|
| 272 |
)
|
| 273 |
|
|
|
|
|
|
|
|
|
|
| 274 |
# --- RED HIGHLIGHT ---
|
| 275 |
decoded_tokens = tokenizer.convert_ids_to_tokens(current_tokens[answer_start:])
|
| 276 |
highlighted = []
|
|
|
|
| 285 |
else:
|
| 286 |
highlighted.append(token_str)
|
| 287 |
|
| 288 |
+
# Compose full input again: prompt + noised answer
|
| 289 |
+
current_tokens = ori_input_tokens[:answer_start] + noised_answer[answer_start:]
|
| 290 |
+
|
| 291 |
yield f"<b>Iteration {i+1}/{max_it} (before noising):</b><br>" + "".join(highlighted).replace('\n', '<br>')
|
| 292 |
+
# time.sleep(pause_length)
|
| 293 |
|
| 294 |
|
| 295 |
answer_ids = current_tokens[answer_start:]
|