GuernikaModelConverter can't convert sd_xl_refiner TextEncoder

#23
by andykoko - opened

VAEEncoder, VAEDecoder and Unet have been successfully converted, but the following error occurred when the step was reached TextEncoder:

Converting text_encoder
Traceback (most recent call last):
  File "guernikatools/torch2coreml.py", line 1679, in <module>
  File "guernikatools/torch2coreml.py", line 1498, in main
  File "guernikatools/torch2coreml.py", line 299, in convert_text_encoder
AttributeError: 'NoneType' object has no attribute 'model_max_length'
[2145] Failed to execute script 'torch2coreml' due to unhandled exception: 'NoneType' object has no attribute 'model_max_length'
[2145] Traceback:
Traceback (most recent call last):
  File "guernikatools/torch2coreml.py", line 1679, in <module>
  File "guernikatools/torch2coreml.py", line 1498, in main
  File "guernikatools/torch2coreml.py", line 299, in convert_text_encoder
AttributeError: 'NoneType' object has no attribute 'model_max_length'

I found that the sd_xl_refiner in Diffusers format only contains TextEncoder2 and does not need the smaller TextEncoder. I wonder if this is the error caused?
So I converted the temporarily generated mlpackage to mlmodelc and copy TextEncoder2.mlmodelc from sd_xl_base, and then sd_xl_refiner can work properly in Guernika.

Guernika org

@andykoko this should be fixed in the latest version of the converter, thanks for the report

Sign up or log in to comment