Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions tests/lora/test_lora_layers_old_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import copy
import gc
import os
import random
import tempfile
Expand Down Expand Up @@ -1662,6 +1663,11 @@ def test_lora_at_different_scales(self):
@deprecate_after_peft_backend
@require_torch_gpu
class LoraIntegrationTests(unittest.TestCase):
def tearDown(self):
super().tearDown()
gc.collect()
torch.cuda.empty_cache()

def test_dreambooth_old_format(self):
generator = torch.Generator("cpu").manual_seed(0)

Expand Down
19 changes: 13 additions & 6 deletions tests/lora/test_lora_layers_peft.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import copy
import gc
import importlib
import os
import tempfile
Expand Down Expand Up @@ -1205,6 +1206,11 @@ class StableDiffusionLoRATests(PeftLoraLoaderMixinTests, unittest.TestCase):
"latent_channels": 4,
}

def tearDown(self):
super().tearDown()
gc.collect()
torch.cuda.empty_cache()

@slow
@require_torch_gpu
def test_integration_move_lora_cpu(self):
Expand Down Expand Up @@ -1434,6 +1440,11 @@ class StableDiffusionXLLoRATests(PeftLoraLoaderMixinTests, unittest.TestCase):
"sample_size": 128,
}

def tearDown(self):
super().tearDown()
gc.collect()
torch.cuda.empty_cache()


@slow
@require_torch_gpu
Expand Down Expand Up @@ -1468,11 +1479,9 @@ class LoraIntegrationTests(PeftLoraLoaderMixinTests, unittest.TestCase):
}

def tearDown(self):
import gc

super().tearDown()
gc.collect()
torch.cuda.empty_cache()
gc.collect()

def test_dreambooth_old_format(self):
generator = torch.Generator("cpu").manual_seed(0)
Expand Down Expand Up @@ -1757,11 +1766,9 @@ class LoraSDXLIntegrationTests(PeftLoraLoaderMixinTests, unittest.TestCase):
}

def tearDown(self):
import gc

super().tearDown()
gc.collect()
torch.cuda.empty_cache()
gc.collect()

def test_sdxl_0_9_lora_one(self):
generator = torch.Generator().manual_seed(0)
Expand Down