Update some torchscript tests after #24505 - #24566
Merged
Merged
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
sgugger
reviewed
Jun 29, 2023
sgugger
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for updating those! Left a comment to replicate across the tests.
Collaborator
Author
|
@sgugger Thanks for the suggestion. I actually copied from the common test file. However, there is model_buffers = list(model.buffers())
for non_persistent_buffer in non_persistent_buffers.values():
found_buffer = False
for i, model_buffer in enumerate(model_buffers):
if torch.equal(non_persistent_buffer, model_buffer):
found_buffer = True
break
self.assertTrue(found_buffer)
model_buffers.pop(i)there (which I didn't see when working on this PR). This uses the So I am going to copy the above block (and therefore keeping using dict). Let me know if you have other opinions instead. |
Collaborator
|
If you end up using the values, no worries. |
Collaborator
Author
|
Copy the mentioned block to all Let's not change this by looking if the model use persistent or non-persistent buffuer: just keep the logic in the common test file. |
sgugger
approved these changes
Jun 29, 2023
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.
What does this PR do?
Need to update the logic in some torchscript tests after #24505