-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathimport_models.py
37 lines (33 loc) · 1.09 KB
/
import_models.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
28
29
30
31
32
33
34
35
36
37
import bentoml
from bentoml.exceptions import NotFound
import diffusers
if __name__ == "__main__":
stage1_signatures = {
"__call__": {"batchable": False},
"encode_prompt": {"batchable": False},
}
stage1_model_tag = "IF-stage1:v1.0"
try:
bentoml.diffusers.get(stage1_model_tag)
except NotFound:
bentoml.diffusers.import_model(
stage1_model_tag, "DeepFloyd/IF-I-XL-v1.0",
signatures=stage1_signatures,
variant="fp16",
pipeline_class=diffusers.DiffusionPipeline,)
stage2_model_tag = "IF-stage2:v1.0"
try:
bentoml.diffusers.get(stage2_model_tag)
except NotFound:
bentoml.diffusers.import_model(
stage2_model_tag, "DeepFloyd/IF-II-L-v1.0",
variant="fp16",
pipeline_class=diffusers.DiffusionPipeline
)
upscaler_model_name = "sd-upscaler"
try:
bentoml.diffusers.get(upscaler_model_name)
except NotFound:
bentoml.diffusers.import_model(
upscaler_model_name, "stabilityai/stable-diffusion-x4-upscaler"
)