mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
cleanup: Lama
This commit is contained in:
parent
f45ea1145d
commit
fa3fcd7820
@ -1,5 +1,4 @@
|
|||||||
import gc
|
import gc
|
||||||
import pathlib
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@ -44,7 +43,8 @@ class LaMA:
|
|||||||
image = torch.from_numpy(image).unsqueeze(0).to(device)
|
image = torch.from_numpy(image).unsqueeze(0).to(device)
|
||||||
mask = torch.from_numpy(mask).unsqueeze(0).to(device)
|
mask = torch.from_numpy(mask).unsqueeze(0).to(device)
|
||||||
|
|
||||||
infilled_image = model(image, mask)
|
with torch.inference_mode():
|
||||||
|
infilled_image = model(image, mask)
|
||||||
|
|
||||||
infilled_image = infilled_image[0].permute(1, 2, 0).detach().cpu().numpy()
|
infilled_image = infilled_image[0].permute(1, 2, 0).detach().cpu().numpy()
|
||||||
infilled_image = np.clip(infilled_image * 255, 0, 255).astype("uint8")
|
infilled_image = np.clip(infilled_image * 255, 0, 255).astype("uint8")
|
||||||
|
Loading…
Reference in New Issue
Block a user