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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/models_core/test_magic_wand.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
As a result, in this test, we just confirm that the top selected tokens of the
sparse models are in the top N selections of same model running dense.

Run `pytest tests/models/test_compressed.py`.
Run `pytest tests/models_core/test_magic_wand.py`.
"""

import gc

import pytest

from tests.models.utils import check_logprobs_close
Expand Down Expand Up @@ -47,6 +49,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


sparse_model = vllm_runner(
model_name=model_name,
Expand Down
Loading