bmaltais / kohya_ss

Apache License 2.0
9.43k stars 1.22k forks source link

ImportError: cannot import name 'train_util' from 'library' #2622

Closed MNeMoNiCuZ closed 2 months ago

MNeMoNiCuZ commented 3 months ago

I'm trying to run a LoRA merge into a checkpoint, but I keep getting this error:

  File "C:\AI\Tools\Training\kohya_ss\sd-scripts\networks\merge_lora.py", line 7, in <module>
    from library import sai_model_spec, train_util
ImportError: cannot import name 'train_util' from 'library' (C:\AI\Tools\Training\kohya_ss\sd-scripts\library\__init__.py)

my __init__.py is empty. I assume this is intended.

Any suggestions?

bmaltais commented 3 months ago

Did you clone the repo with the --recursive option?

MNeMoNiCuZ commented 3 months ago

Did you clone the repo with the --recursive option?

Good question, I can't recall.

Is there any way of checking after the fact?

bmaltais commented 3 months ago

Best is to delete the folder and re clone

MNeMoNiCuZ commented 2 months ago

That fixed it. Thank you. I had missed the instruction to use --recursive on my git clone operation. I have never seen that being needed before!

Good to know that it mostly works without it though (for LoRA training and merging at least).