Skip to content

Commit

Permalink
Fix vmin for step scores
Browse files Browse the repository at this point in the history
  • Loading branch information
gsarti committed Aug 8, 2024
1 parent 20f963c commit 539f0cc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions inseq/data/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ def show_token_attributions(
title = "Generated text:\n\n"
if step_score_highlight is not None:
step_scores = attr.step_scores[step_score_highlight]
scores_vmin = step_scores.min().item()
scores_vmax = step_scores.max().item()
title = f"Generated text with {step_score_highlight} highlights:\n\n"
generated_token_parts.append(rp.custom_style(rp.text(title), css_style="font-weight: bold;"))
Expand Down Expand Up @@ -333,7 +332,7 @@ def show_token_attributions(
if step_scores is not None:
gen_tok_label = fg.treescope_part_from_display_object(
fg.text_on_color(
curr_gen_tok, value=round(step_scores[gen_idx].item(), 4), vmin=scores_vmin, vmax=scores_vmax
curr_gen_tok, value=round(step_scores[gen_idx].item(), 4), vmax=scores_vmax
)
)
else:
Expand Down

0 comments on commit 539f0cc

Please sign in to comment.