forked from patienceai/stable-diffusion-automatic1111-banana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
27 lines (23 loc) · 677 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import torch
import modules.safe as safe
import webui
torch.load = safe.unsafe_torch_load
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
def noop(*args, **kwargs):
pass
def register_model():
global model
try:
from modules import shared, sd_hijack
shared.sd_model = model
sd_hijack.model_hijack.hijack(model)
except:
print("Failed to hijack model.")
def init():
global model
import modules.sd_models
modules.sd_models.list_models()
modules.sd_models.list_models = noop
model = modules.sd_models.load_model()
modules.sd_models.load_model = noop
register_model()