Linaqruf / sd-notebook-collection

209 stars 42 forks source link

LoRAs from google drive #8

Open Squirrel03 opened 1 year ago

Squirrel03 commented 1 year ago

Hi, I really appreciate your program! Thank you for your hard work!! I donated a coffee! :) And I want to ask one more question.

Is it possible to open files from Google Drive, as well as Civitai files, on the program? I tried to open Google Drive addresses, but the links for some models and LoRAs wouldn't work and one LoRA went to the models section. I have some personal LoRAs and models that I would like to use, and some of the models that I was using through Civitai are now unavailable. So I would really like to use the Google Drive addresses, is there any way you can assist?

I'm also having trouble opening hypernetwork, LoRA section when I use i2i. I have to go to t2i and click LoRAs and copy and paste them. Could you fix this, as well?

Linaqruf commented 1 year ago

Hello sir, I'm very sorry for the very late reply, and thank you so much for the coffee. I was updating kohya trainer and not touching Cagliostro Web UI for a few days.

I think it's already support load model from gdrive but it seems I'm wrong, it can't create symbolic link from gdrive to sd webui. I'll try to fix it in next few days, I'll let you know if it already fixed

Squirrel03 commented 1 year ago

Hello sir, I'm very sorry for the very late reply, and thank you so much for the coffee. I was updating kohya trainer and not touching Cagliostro Web UI for a few days.

I think it's already support load model from gdrive but it seems I'm wrong, it can't create symbolic link from gdrive to sd webui. I'll try to fix it in next few days, I'll let you know if it already fixed

thanks for your reply!! okay I will wait for your update!! You're a genius! thank you.

magicFeirl commented 1 year ago

Hello sir, I'm very sorry for the very late reply, and thank you so much for the coffee. I was updating kohya trainer and not touching Cagliostro Web UI for a few days.

I think it's already support load model from gdrive but it seems I'm wrong, it can't create symbolic link from gdrive to sd webui. I'll try to fix it in next few days, I'll let you know if it already fixed

Hello! I just try to soft link files from my google drive to sd web ui and It's works fine. Here is my example code:

import os
def flat_ln(dir, target):
  paths = []

  def helper(dir, target):
    dir_path = os.path.join(dir)
    for filename in os.listdir(dir_path):
      fullpath = os.path.join(dir_path, filename)
      if os.path.isdir(fullpath):
        helper(fullpath, target)
      elif os.path.isfile(fullpath) and not os.path.exists(os.path.join(target, filename)):
        # ln file to `target` only when file doesn't exist at `target`
        paths.append(fullpath)

  helper(dir, target)

  ln_files = ' '.join(paths)

  !ln -s {ln_files} {target}

flat_ln('your drive file dir', 'LoRA/VAE/models dir etc.')

Hope it can help you.