call GC between each e2e test to avoid OOM

This commit is contained in:
Pierre Chapuis 2024-01-29 14:38:17 +01:00
parent 5a8389ee0d
commit 19bc081658

View file

@ -1,3 +1,4 @@
import gc
from pathlib import Path
from typing import Iterator
from warnings import warn
@ -30,6 +31,13 @@ from refiners.foundationals.latent_diffusion.stable_diffusion_xl.model import St
from tests.utils import ensure_similar_images
@pytest.fixture(autouse=True)
def ensure_gc():
# Avoid GPU OOMs
# See https://github.com/pytest-dev/pytest/discussions/8153#discussioncomment-214812
gc.collect()
@pytest.fixture(scope="module")
def ref_path(test_e2e_path: Path) -> Path:
return test_e2e_path / "test_diffusion_ref"