Spaces:
Sleeping
Sleeping
Commit ·
d134e9a
1
Parent(s): e13b1ba
Improve UI clarity: rename generation settings labels and remove score display
Browse files- app.py +11 -9
- components/glossary.py +1 -1
- todo.md +14 -0
app.py
CHANGED
|
@@ -82,7 +82,7 @@ app.layout = html.Div([
|
|
| 82 |
|
| 83 |
html.Div([
|
| 84 |
html.Div([
|
| 85 |
-
html.Label("
|
| 86 |
dcc.Slider(
|
| 87 |
id='max-new-tokens-slider',
|
| 88 |
min=1, max=20, step=1, value=1,
|
|
@@ -92,7 +92,7 @@ app.layout = html.Div([
|
|
| 92 |
], style={'flex': '1', 'marginRight': '20px'}),
|
| 93 |
|
| 94 |
html.Div([
|
| 95 |
-
html.Label("
|
| 96 |
dcc.Slider(
|
| 97 |
id='beam-width-slider',
|
| 98 |
min=1, max=5, step=1, value=1,
|
|
@@ -331,12 +331,11 @@ def run_generation(n_clicks, model_name, prompt, max_new_tokens, beam_width, pat
|
|
| 331 |
results_ui = []
|
| 332 |
if max_new_tokens > 1:
|
| 333 |
results_ui.append(html.H4("Generated Sequences", className="section-title"))
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
], style={'marginBottom': '5px'}),
|
| 340 |
html.Div(result['text'], style={'fontFamily': 'monospace', 'backgroundColor': '#fff', 'padding': '10px', 'borderRadius': '4px', 'border': '1px solid #dee2e6'}),
|
| 341 |
html.Button("Analyze", id={'type': 'result-item', 'index': i}, n_clicks=0,
|
| 342 |
className="action-button secondary-button", style={'marginTop': '10px', 'fontSize': '12px'})
|
|
@@ -508,8 +507,11 @@ def update_pipeline_content(activation_data, model_name):
|
|
| 508 |
outputs.append(create_mlp_content(num_layers, hidden_dim, intermediate_dim))
|
| 509 |
|
| 510 |
# Stage 5: Output
|
|
|
|
|
|
|
| 511 |
outputs.append(f"→ {predicted_token}")
|
| 512 |
-
outputs.append(create_output_content(top_tokens, predicted_token, predicted_prob
|
|
|
|
| 513 |
|
| 514 |
return tuple(outputs)
|
| 515 |
|
|
|
|
| 82 |
|
| 83 |
html.Div([
|
| 84 |
html.Div([
|
| 85 |
+
html.Label("Number of New Tokens:", className="input-label"),
|
| 86 |
dcc.Slider(
|
| 87 |
id='max-new-tokens-slider',
|
| 88 |
min=1, max=20, step=1, value=1,
|
|
|
|
| 92 |
], style={'flex': '1', 'marginRight': '20px'}),
|
| 93 |
|
| 94 |
html.Div([
|
| 95 |
+
html.Label("Number of Generation Choices:", className="input-label"),
|
| 96 |
dcc.Slider(
|
| 97 |
id='beam-width-slider',
|
| 98 |
min=1, max=5, step=1, value=1,
|
|
|
|
| 331 |
results_ui = []
|
| 332 |
if max_new_tokens > 1:
|
| 333 |
results_ui.append(html.H4("Generated Sequences", className="section-title"))
|
| 334 |
+
for i, result in enumerate(results):
|
| 335 |
+
results_ui.append(html.Div([
|
| 336 |
+
html.Div([
|
| 337 |
+
html.Span(f"Rank {i+1}", style={'fontWeight': 'bold', 'marginRight': '10px', 'color': '#667eea'})
|
| 338 |
+
], style={'marginBottom': '5px'}),
|
|
|
|
| 339 |
html.Div(result['text'], style={'fontFamily': 'monospace', 'backgroundColor': '#fff', 'padding': '10px', 'borderRadius': '4px', 'border': '1px solid #dee2e6'}),
|
| 340 |
html.Button("Analyze", id={'type': 'result-item', 'index': i}, n_clicks=0,
|
| 341 |
className="action-button secondary-button", style={'marginTop': '10px', 'fontSize': '12px'})
|
|
|
|
| 507 |
outputs.append(create_mlp_content(num_layers, hidden_dim, intermediate_dim))
|
| 508 |
|
| 509 |
# Stage 5: Output
|
| 510 |
+
# Get original prompt for context display
|
| 511 |
+
original_prompt = activation_data.get('prompt', '')
|
| 512 |
outputs.append(f"→ {predicted_token}")
|
| 513 |
+
outputs.append(create_output_content(top_tokens, predicted_token, predicted_prob,
|
| 514 |
+
original_prompt=original_prompt))
|
| 515 |
|
| 516 |
return tuple(outputs)
|
| 517 |
|
components/glossary.py
CHANGED
|
@@ -46,7 +46,7 @@ def create_glossary_modal():
|
|
| 46 |
_create_term_entry(
|
| 47 |
"Beam Search",
|
| 48 |
"Exploring Multiple Paths",
|
| 49 |
-
"Instead of just picking the single best next word, Beam Search explores several likely future paths simultaneously (like parallel universes) and picks the one that makes the most sense overall."
|
| 50 |
)
|
| 51 |
], className="glossary-content", style={'maxHeight': '60vh', 'overflowY': 'auto', 'padding': '0 20px 10px 10px'})
|
| 52 |
|
|
|
|
| 46 |
_create_term_entry(
|
| 47 |
"Beam Search",
|
| 48 |
"Exploring Multiple Paths",
|
| 49 |
+
"Instead of just picking the single best next word, Beam Search explores several likely future paths simultaneously (like parallel universes) and picks the one that makes the most sense overall. The 'Number of Generation Choices' setting controls how many paths are explored at once."
|
| 50 |
)
|
| 51 |
], className="glossary-content", style={'maxHeight': '60vh', 'overflowY': 'auto', 'padding': '0 20px 10px 10px'})
|
| 52 |
|
todo.md
CHANGED
|
@@ -25,3 +25,17 @@
|
|
| 25 |
- [x] Delete `prompt_comparison.py`
|
| 26 |
- [x] Update `utils/__init__.py` exports
|
| 27 |
- [x] Add pipeline CSS styles to `assets/style.css`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
- [x] Delete `prompt_comparison.py`
|
| 26 |
- [x] Update `utils/__init__.py` exports
|
| 27 |
- [x] Add pipeline CSS styles to `assets/style.css`
|
| 28 |
+
|
| 29 |
+
## Completed: Pipeline Clarity Improvements (Agent A)
|
| 30 |
+
|
| 31 |
+
- [x] Rename "Max New Tokens:" to "Number of New Tokens:" in app.py
|
| 32 |
+
- [x] Rename "Beam Width:" to "Number of Generation Choices:" in app.py
|
| 33 |
+
- [x] Remove score display from generated sequences in app.py
|
| 34 |
+
- [x] Update glossary to clarify "Number of Generation Choices" relates to Beam Search
|
| 35 |
+
|
| 36 |
+
## In Progress: Pipeline Clarity Improvements (Agent D)
|
| 37 |
+
|
| 38 |
+
- [ ] Switch generate_bertviz_html from model_view to head_view in model_patterns.py
|
| 39 |
+
- [ ] Deprecate _get_top_attended_tokens function (remove usage in extract_layer_data)
|
| 40 |
+
- [ ] Add generate_head_view_with_categories function for categorized attention heads
|
| 41 |
+
- [ ] Run tests to verify no regressions
|