Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,9 @@ import torch
|
|
7 |
from huggingface_hub import snapshot_download
|
8 |
import openvino.runtime as ov
|
9 |
from typing import Optional, Dict
|
|
|
|
|
|
|
10 |
|
11 |
model_id = "Disty0/LCM_SoteMix"
|
12 |
#model_id = "Disty0/sotediffusion-v2" #不可
|
@@ -15,6 +18,7 @@ model_id = "Disty0/LCM_SoteMix"
|
|
15 |
HIGH=768
|
16 |
WIDTH=512
|
17 |
|
|
|
18 |
|
19 |
batch_size = -1
|
20 |
class CustomOVModelVaeDecoder(OVModelVaeDecoder):
|
@@ -24,7 +28,7 @@ class CustomOVModelVaeDecoder(OVModelVaeDecoder):
|
|
24 |
super(OVModelVaeDecoder, self).__init__(model, parent_model, ov_config, "vae_decoder", model_dir)
|
25 |
|
26 |
|
27 |
-
pipe = OVStableDiffusionPipeline.from_pretrained(model_id, compile = False, ov_config = {"CACHE_DIR":""})
|
28 |
|
29 |
taesd_dir = snapshot_download(repo_id="deinferno/taesd-openvino")
|
30 |
pipe.vae_decoder = CustomOVModelVaeDecoder(model = OVBaseModel.load_model(f"{taesd_dir}/vae_decoder/openvino_model.xml"), parent_model = pipe, model_dir = taesd_dir)
|
|
|
7 |
from huggingface_hub import snapshot_download
|
8 |
import openvino.runtime as ov
|
9 |
from typing import Optional, Dict
|
10 |
+
from transformers import CLIPFeatureExtractor, CLIPTokenizer
|
11 |
+
|
12 |
+
|
13 |
|
14 |
model_id = "Disty0/LCM_SoteMix"
|
15 |
#model_id = "Disty0/sotediffusion-v2" #不可
|
|
|
18 |
HIGH=768
|
19 |
WIDTH=512
|
20 |
|
21 |
+
tokenizer = CLIPTokenizer.from_pretrained(model_id)
|
22 |
|
23 |
batch_size = -1
|
24 |
class CustomOVModelVaeDecoder(OVModelVaeDecoder):
|
|
|
28 |
super(OVModelVaeDecoder, self).__init__(model, parent_model, ov_config, "vae_decoder", model_dir)
|
29 |
|
30 |
|
31 |
+
pipe = OVStableDiffusionPipeline.from_pretrained(model_id, compile = False, ov_config = {"CACHE_DIR":""}, tokenizer=tokenizer,)
|
32 |
|
33 |
taesd_dir = snapshot_download(repo_id="deinferno/taesd-openvino")
|
34 |
pipe.vae_decoder = CustomOVModelVaeDecoder(model = OVBaseModel.load_model(f"{taesd_dir}/vae_decoder/openvino_model.xml"), parent_model = pipe, model_dir = taesd_dir)
|