Fix Week 14 BERT large lab: history key names, val_loss scalar, optimizer TODO guidance#15
Merged
raminmohammadi merged 1 commit intoJun 12, 2026
Conversation
…izer TODO guidance
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates BERT QA training visualization and notebook scaffolding to align with current metric naming and improve assignment guidance/readability.
Changes:
- Update
plot_training_historyto use*_logits_losshistory keys. - Reformat notebook JSON (cell metadata/layout) and adjust a validation-loss test call to use the final epoch value.
- Add/adjust inline instructional text (learning rate guidance).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| Labs/Week_14/BERT/helpers.py | Switches plotted metric keys from *_positions_loss to *_logits_loss to match current training outputs. |
| Labs/Week_14/BERT/Assignment.ipynb | Notebook JSON restructuring plus small logic/text edits (final val_loss passed to test; guidance text). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+58
to
+60
| plt.plot(history.history['start_logits_loss'], | ||
| label='Start Position Training Loss') | ||
| plt.plot(history.history['val_start_positions_loss'], | ||
| plt.plot(history.history['val_start_logits_loss'], |
Comment on lines
+69
to
+71
| plt.plot(history.history['end_logits_loss'], | ||
| label='End Position Training Loss') | ||
| plt.plot(history.history['val_end_positions_loss'], | ||
| plt.plot(history.history['val_end_logits_loss'], |
| # 4. Combined Metrics | ||
| plt.subplot(2, 2, 4) | ||
| metrics = ['loss', 'start_positions_loss', 'end_positions_loss'] | ||
| metrics = ['loss', 'start_logits_loss', 'end_logits_loss'] |
| "id": "_ulwVvROU3EJ" | ||
| }, | ||
| "source": [ | ||
| "**Relection**\n", |
| } | ||
| }, | ||
| "source": [ | ||
| "In order to pass this test, **achieve validation loss atleast less than 2**." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three fixes so the Week 14 BERT large lab runs after TF/transformers version drift:
plot_training_history (helpers.py): per-output loss keys are now named after the model outputs (start_logits/end_logits) instead of the label columns (start_positions/end_positions). Updated the 6 history keys so plotting no longer raises KeyError.
main(): pass a scalar to test_model_loss instead of the full per-epoch val_loss list, using history.history['val_loss'][-1]. Fixes TypeError: '<=' not supported between 'list' and 'float'.
create_qa_model: clarified the optimizer TODO so students don't fall back to the 1e-3 default learning rate, with guidance on the expected init_lr magnitude (around 2e-5 to 5e-5).