ogkalu2 / Merge-Stable-Diffusion-models-without-distortion

Adaptation of the merging method described in the paper - Git Re-Basin: Merging Models modulo Permutation Symmetries (https://arxiv.org/abs/2209.04836) for Stable Diffusion
MIT License
139 stars 21 forks source link

Google Colab version pointing to Google Drive folder for ckpts? #12

Open bennitheblog opened 1 year ago

bennitheblog commented 1 year ago

Thank you for this code. Tried this locally but my computer did not have enough memory to execute this. Any chance someone can please create a Google Colab notebook that executes this code and can merge ckpts located in a Google Drive folder?

Thanks in advance.

ogkalu2 commented 1 year ago

Hi. There's been quite a number of optimizations since the so you may want to try again. Regardless, here you go https://colab.research.google.com/drive/1hQd6vyF-L5XgBErCjmEZX8hazYt0-iXo?usp=sharing

bennitheblog commented 1 year ago

Thank you! I ran this and got this error:

Traceback (most recent call last): File "SD_rebasin_merge.py", line 5, in File "/content/drive/MyDrive/sd/stable-diffusion-webui/models/Stable-diffusion/weight_matching.py", line 5, in File "", line 983, in _find_and_load File "", line 963, in _find_and_load_unlocked File "", line 906, in _find_spec File "", line 1280, in find_spec File "", line 1252, in _get_spec File "", line 1368, in find_spec File "", line 1408, in _fill_cache OSError: [Errno 107] Transport endpoint is not connected: '/content/drive/MyDrive/sd/stable-diffusion-webui/models/Stable-diffusion'

bennitheblog commented 1 year ago

/content/drive/MyDrive/sd/stable-diffusion-webui/models/Stable-diffusion is where I've saved everything; your code files and also my ckpts.

bennitheblog commented 1 year ago

Yes, everything is in that folder.

bennitheblog commented 1 year ago

Tried to rerun and here is the updated error message:

ERROR:root:Internal Python error in the inspect module. Below is the traceback from this internal error.

Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/IPython/core/interactiveshell.py", line 3326, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in get_ipython().run_line_magic('cd', '/content/drive/MyDrive/sd/stable-diffusion-webui/models/Stable-diffusion/') File "/usr/local/lib/python3.7/dist-packages/IPython/core/interactiveshell.py", line 2314, in run_line_magic result = fn(*args, kwargs) File "", line 2, in cd File "/usr/local/lib/python3.7/dist-packages/IPython/core/magic.py", line 187, in call = lambda f, *a, *k: f(a, k) File "/usr/local/lib/python3.7/dist-packages/IPython/core/magics/osm.py", line 334, in cd oldcwd = os.getcwd() OSError: [Errno 107] Transport endpoint is not connected

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/IPython/core/interactiveshell.py", line 2040, in showtraceback stb = value._rendertraceback() AttributeError: 'OSError' object has no attribute '_rendertraceback'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/IPython/core/ultratb.py", line 1101, in get_records return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset) File "/usr/local/lib/python3.7/dist-packages/IPython/core/ultratb.py", line 319, in wrapped return f(*args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/IPython/core/ultratb.py", line 353, in _fixed_getinnerframes records = fix_frame_records_filenames(inspect.getinnerframes(etb, context)) File "/usr/lib/python3.7/inspect.py", line 1502, in getinnerframes frameinfo = (tb.tb_frame,) + getframeinfo(tb, context) File "/usr/lib/python3.7/inspect.py", line 1460, in getframeinfo filename = getsourcefile(frame) or getfile(frame) File "/usr/lib/python3.7/inspect.py", line 696, in getsourcefile if getattr(getmodule(object, filename), 'loader', None) is not None: File "/usr/lib/python3.7/inspect.py", line 725, in getmodule file = getabsfile(object, _filename) File "/usr/lib/python3.7/inspect.py", line 709, in getabsfile return os.path.normcase(os.path.abspath(_filename)) File "/usr/lib/python3.7/posixpath.py", line 383, in abspath cwd = os.getcwd() OSError: [Errno 107] Transport endpoint is not connected