Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

[ CI ] Fix Failing Magic Wand Test #311

Merged
merged 4 commits into from
Jun 18, 2024

Conversation

robertgshaw2-neuralmagic
Copy link
Collaborator

SUMMARY:

@robertgshaw2-neuralmagic robertgshaw2-neuralmagic changed the title add gc [ CI ] Fix Failing Magic Wand Test Jun 18, 2024
@@ -6,6 +6,7 @@
Run `pytest tests/models/test_compressed.py`.

Choose a reason for hiding this comment

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

could you fix this doc line while you're in here?

@@ -47,6 +48,7 @@ def test_magic_wand(
dense_outputs = dense_model.generate_greedy_logprobs(
example_prompts, max_tokens, num_logprobs)
del dense_model
gc.collect()

Choose a reason for hiding this comment

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

should you also gc.collect() the sparse_model down below too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Script is over by then, so not needed. We just need to make sure the dense model is cleaned up before we start the sparse model

Copy link
Member

Choose a reason for hiding this comment

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

approved, but wondering if we should try to encapsulate cleanup in a helper function. even if "gc.collect()" isn't always needed it might be good practice.

Choose a reason for hiding this comment

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

what about for the next test, though? are we guaranteed that everything is cleaned up by then?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yep

Copy link
Member

@andy-neuma andy-neuma left a comment

Choose a reason for hiding this comment

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

thanks

@@ -47,6 +48,7 @@ def test_magic_wand(
dense_outputs = dense_model.generate_greedy_logprobs(
example_prompts, max_tokens, num_logprobs)
del dense_model
gc.collect()
Copy link
Member

Choose a reason for hiding this comment

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

approved, but wondering if we should try to encapsulate cleanup in a helper function. even if "gc.collect()" isn't always needed it might be good practice.

@robertgshaw2-neuralmagic
Copy link
Collaborator Author

thanks

The del is a custom __del__ for VLLMModelRunner ... I am hesitant to touch that code to avoid upstream sync issues.

But can try it there...

@robertgshaw2-neuralmagic robertgshaw2-neuralmagic merged commit 1ad0b34 into main Jun 18, 2024
17 checks passed
@robertgshaw2-neuralmagic robertgshaw2-neuralmagic deleted the fix-failing-magic-wand-test branch June 18, 2024 15:35
derekk-nm pushed a commit that referenced this pull request Jun 24, 2024
SUMMARY:
* Fix https://app.asana.com/0/1206976017967941/1207600124500657
* Issue was that we were not tearing down the model fully before
initializing a new vllm instance. Calling `gc.collect()` seems to force
this to happen
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants