Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Explain step for tied weights #3214

Merged
merged 38 commits into from
Mar 10, 2023
Merged

Conversation

geoffreyangus
Copy link
Collaborator

@geoffreyangus geoffreyangus commented Mar 6, 2023

This PR fixes the explain step for tied weights. Prior to this change, the explain step would fail with the following error:

One of the differentiated Tensors appears to not have been used in the graph.

We tracked this failure down to the fact that Captum doesn't like it when you pass duplicates of the same torch module into the integrated gradients step.

The fix for this was to create a deep copy of the tied torch module and update the computation graph used during the explanation step to use the deep copy so that every target layer passed into Captum is only forward-passed once per batch.

@github-actions
Copy link

github-actions bot commented Mar 6, 2023

Unit Test Results

         6 files  ±    0           6 suites  ±0   6h 29m 55s ⏱️ + 35m 12s
  4 022 tests +    1    3 978 ✔️ ±    0    43 💤 ±0  1 +1 
11 975 runs   - 106  11 843 ✔️  - 104  129 💤  - 5  3 +3 

For more details on these failures, see this check.

Results for commit a6f1ecc. ± Comparison against base commit e3a9416.

♻️ This comment has been updated with latest results.

@geoffreyangus geoffreyangus changed the base branch from master to sequence-length-param March 10, 2023 01:59
@geoffreyangus geoffreyangus marked this pull request as ready for review March 10, 2023 02:08
@geoffreyangus geoffreyangus marked this pull request as draft March 10, 2023 02:08
@geoffreyangus geoffreyangus marked this pull request as ready for review March 10, 2023 02:34
Copy link
Contributor

@jppgks jppgks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thanks @geoffreyangus !

Copy link
Collaborator

@connor-mccorm connor-mccorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, side note, great docstrings and comments - made it very easy to review this PR!

Base automatically changed from sequence-length-param to master March 10, 2023 21:18
@geoffreyangus geoffreyangus merged commit 7d6885e into master Mar 10, 2023
@geoffreyangus geoffreyangus deleted the fix-explain-tied-weights branch March 10, 2023 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants