@@ -69,7 +69,7 @@ def LPW_Path(self):
6969
7070 return dir_path
7171
72- def GetPipe (self , Model : str , Mode : str , NSFW : bool ):
72+ def GetPipe (self , Model : str , Mode : str , NSFW : bool , TextEnc : str ):
7373 pipe = None
7474 nsfw_pipe = None
7575
@@ -87,11 +87,13 @@ def GetPipe(self, Model: str, Mode: str, NSFW: bool):
8787 nsfw_pipe = OnnxRuntimeModel .from_pretrained (safety_model , provider = self .prov )
8888 print (Mode )
8989 if Mode == "txt2img" :
90- pipe = OnnxStableDiffusionPipeline .from_pretrained (Model , custom_pipeline = self .LPW_Path (), provider = self .prov , safety_checker = nsfw_pipe )
90+ pipe = OnnxStableDiffusionPipeline .from_pretrained (Model , custom_pipeline = self .LPW_Path (), provider = self .prov , safety_checker = nsfw_pipe , text_encoder = None )
9191 if Mode == "img2img" :
92- pipe = OnnxStableDiffusionImg2ImgPipeline .from_pretrained (Model , custom_pipeline = self .LPW_Path (), provider = self .prov , safety_checker = nsfw_pipe )
92+ pipe = OnnxStableDiffusionImg2ImgPipeline .from_pretrained (Model , custom_pipeline = self .LPW_Path (), provider = self .prov , safety_checker = nsfw_pipe , text_encoder = None )
9393 if Mode == "inpaint" :
94- pipe = OnnxStableDiffusionInpaintPipeline .from_pretrained (Model , custom_pipeline = self .LPW_Path (), provider = self .prov , safety_checker = nsfw_pipe )
94+ pipe = OnnxStableDiffusionInpaintPipeline .from_pretrained (Model , custom_pipeline = self .LPW_Path (), provider = self .prov , safety_checker = nsfw_pipe , text_encoder = None )
95+
96+ pipe .text_encoder = OnnxRuntimeModel .from_pretrained (TextEnc , provider = self .prov )
9597 else :
9698 if Mode == "pix2pix" :
9799 if NSFW :
@@ -399,6 +401,9 @@ def ApplyArg(parser):
399401 parser .add_argument (
400402 "--model" , type = str , help = "Path to model checkpoint (.ckpt or .safetensors)" , dest = 'mdlpath' ,
401403 )
404+ parser .add_argument (
405+ "--textencoder" , type = str , help = "Path to model checkpoint (.onnx)" , dest = 'textencoder' ,
406+ )
402407 parser .add_argument (
403408 "--workdir" , default = None , type = str , help = "Path to working directory" , dest = 'workdir' ,
404409 )
0 commit comments