derrian-distro / LoRA_Easy_Training_Scripts

A UI made in Pyside6 to make training LoRA/LoCon and other LoRA type models in sd-scripts easy
GNU General Public License v3.0
998 stars 101 forks source link

numpy.core.multiarray failed to import #221

Closed jetsletmethehellin closed 2 weeks ago

jetsletmethehellin commented 3 weeks ago

I have a feeling this has to do with my numpy version but I've tried three different versions <2 and I keep getting this. Would it be possible to figure out which precise version is expected? (I'm pretty entry-level so I'm probably missing something blatantly obvious.)

Jelosus2 commented 3 weeks ago

Are you using main or dev branch?

jetsletmethehellin commented 3 weeks ago

Main I think? Whatever's in Releases. "UI Release v1". Or rather whatever installs with the method that release directed me to.

Jelosus2 commented 3 weeks ago

That's main branch, could you try the dev version? The installation process is almost the same:

  1. Run git clone -b dev https://github.com/derrian-distro/LoRA_Easy_Training_Scripts
  2. Execute the install.bat file.
jetsletmethehellin commented 3 weeks ago

That one just crashes as soon as I try to open the UI without any warning. Could just be that my PC's too old for this sort of thing, which was something I entertained from the start.

Jelosus2 commented 2 weeks ago

is there some kind of error in the console?

jetsletmethehellin commented 2 weeks ago

Nope, the whole command prompt just closed on me without warning. This was only with the dev version for the record; the other opens fine, it just gives me this error when I try to train with it.

Edit: Now that I think of it, it may have something to do with the fact that I didn't allow setup permission to do the whole "access shell unrestricted" thing. I didn't feel comfortable giving something that kinda power so I just hit cancel when Windows asked me to confirm and that could well be causing the crash. But I did so with the public version too and that didn't crash, so weird.

Jelosus2 commented 2 weeks ago

that permission is to allow all to install without problems. On a different note, what GPU do you have and how much RAM?

jetsletmethehellin commented 2 weeks ago

32 GB RAM, but the GPU is an old 1080Ti.

Jelosus2 commented 2 weeks ago

should still be ok, hmm, could you try reinstalling but this time allowing the admin prompt?

jetsletmethehellin commented 2 weeks ago

Hmm... What precisely does the admin prompt allow the installation to do? And do those permissions persist beyond the install process, either for the trainer or for anything else that uses Python?

Jelosus2 commented 2 weeks ago

It executes a command that disables temporarily the execution policy so all the scripts can be installed correctly without issue because on Windows sometimes there's cases of scripts that couldn't be installed correctly because the execution policy was enabled and restricted. And for the second question, it doesn't persist after the execution policy is disabled.

jetsletmethehellin commented 2 weeks ago

So it's basically just like when an installer for any other program asks permission during install.

Hmmm... I'll consider it. As I'm not a particularly experienced programmer, anything involving a command prompt still gives me a bit of unreasonable anxiety, so something that runs through command prompt asking for shell permission sets off alarms in my brain just by matter of course. I know it's unreasonable, but I'm that way, haha.

If I do decide to do it, I'll report back with results.

Jelosus2 commented 2 weeks ago

I mean, a lot of people use this UI (myself included) and I can assure you that it has no malware, and even more because you can check the code here. It's open source so anyone can check the code, and if they found something suspicious there would be reddit posts and all of that already.

derrian-distro commented 2 weeks ago

Hmm... What precisely does the admin prompt allow the installation to do? And do those permissions persist beyond the install process, either for the trainer or for anything else that uses Python?

https://github.com/kohya-ss/sd-scripts?tab=readme-ov-file#windows-required-dependencies kohya requires this to be done for windows, and as much as I wanted to get around it, I couldn't

jetsletmethehellin commented 2 weeks ago

Hmm. That's a good point actually. Well, like I said, I'll try to get over my anxiety and do it. I know I'm being unreasonable, it's just one of those things where my subconscious won't listen to my conscious brain, like agoraphobia or what have you. 😅

@derrian-distro Good to know. If I weren't so weird I'd just install the thing right away. :P I can probably get over the concern, but it'll take me a bit to psyche myself up. I'll report back when I've managed it!

jetsletmethehellin commented 2 weeks ago

Okay! I went ahead and set the fears aside and redid the dev install with permissions granted. The UI did load but training failed; I got these errors:

During Install: DEPRECATION: LoraEasyCustomOptimizer is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option.

Traceback (most recent call last): File "<...>\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 816, in move os.rename(src, real_dst) OSError: [WinError 17] The system cannot move the file to a different disk drive: 'default_config.yaml' -> '<...>\.cache\huggingface\accelerate\default_config.yaml'

OSError: Can't load tokenizer for 'openai/clip-vit-base-patch32'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'openai/clip-vit-base-patch32' is the correct path to a directory containing all relevant files for a CLIPTokenizer tokenizer.

During Load of UI: <...>\backend\sd_scripts\venv\lib\site-packages\transformers\utils\generic.py:441: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead. _torch_pytree._register_pytree_node( <...>\backend\sd_scripts\venv\lib\site-packages\transformers\utils\generic.py:309: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead. _torch_pytree._register_pytree_node( <...>\backend\sd_scripts\venv\lib\site-packages\diffusers\utils\outputs.py:63: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead. torch.utils._pytree._register_pytree_node(

Traceback (most recent call last): File "<...>\LoRA_Easy_Training_Scripts\backend\main.py", line 19, in tokenizer = CLIPTokenizer.from_pretrained("openai/clip-vit-base-patch32") File "<...>\LoRA_Easy_Training_Scripts\backend\sd_scripts\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 2012, in from_pretrained raise EnvironmentError( OSError: Can't load tokenizer for 'openai/clip-vit-base-patch32'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'openai/clip-vit-base-patch32' is the correct path to a directory containing all relevant files for a CLIPTokenizer tokenizer.

During Training: HTTPConnectionPool(host='127.0.0.1', port=8000): Max retries exceeded with url: /validate (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001F4D285EA10>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))

The last one is particularly weird. I'd guess it's caused by my firewall somehow but... how, given that the connection is literally coming from the computer itself, I wouldn't know.

(As far as Pip I hope I can just ignore that one because while I keep getting told pip is outdated, every time I try to update it it seems to go through, but then I get the same version notice every time I install something where pip is involved.)

Jelosus2 commented 2 weeks ago

Ok, for the "The system cant move the file to a different hard drive" you have to go to C:/Users/YOUR_USER/.cache/huggingface and you should see a file with no extension called accelerate, delete it and run the installer again.

jetsletmethehellin commented 2 weeks ago

Yep! No error there this time. The load errors and the weird connection issue are still there though. Connection issue was happening when I tried Kohya, too, so pretty sure that's on my end but it makes no sense to think my firewall would be blocking a connection from my own computer.

Jelosus2 commented 2 weeks ago

The tokenizer and connection refused errors you mean?

jetsletmethehellin commented 2 weeks ago

Yep. All the stuff listed under During Load of UI and During Training. Honestly the tokenizer thing might not have been there at install the first time, my workflow is a mess and I may've gotten confused.

Jelosus2 commented 2 weeks ago

the connection issue is not because of the firewall. Follow this steps:

  1. Place yourself in the directory of the trainer, then go to backend/sd_scripts
  2. Go to venv/Scripts -> Open a cmd in that location -> execute activate command -> execute this commands one by one in order:
    pip install -U torch==2.2.1 torchvision==0.17.1 --index-url https://download.pytorch.org/whl/cu121
    pip install -U xformers==0.0.25 --index-url https://download.pytorch.org/whl/cu121
    pip install -U -r requirements.txt
    pip install -U ../custom_scheduler/.
    pip install -U -r ../requirements.txt
jetsletmethehellin commented 2 weeks ago

I'm out of time to focus heavily on things just now, but I'll do that as soon as my schedule frees up again. I appreciate all the patience! I know it must be annoying dealing with a programing noob, haha.

jetsletmethehellin commented 2 weeks ago

Alright, in the process but it's saying requirements.txt doesn't exist ("no such file or directory").

I assumed it was the same from the main folder so I copy-pasted that into the directory I'm working in but it then said the file from line 42 of requirements.txt "does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found."

jetsletmethehellin commented 2 weeks ago

Update: I decided to stop being dumb and realized that there's a scripts.py in the main folder too. Dropped that in the working directory and everything went smooth until ../custom_scheduler/. at which point it returned "Invalid requirement: ../custom_scheduler/."

(I really hope that was something I was supposed to type literally and not something I failed to interpret cuz I feel pretty dumb right now as it is... 😅)

Jelosus2 commented 2 weeks ago

Do you have a Discord account? If so, we can talk there, would be easier and more comfy. My username is Jelosus1, you can send me friend request and Ill help you to troubleshoot your problems :)

jetsletmethehellin commented 2 weeks ago

Yeah, though I only use it as a Civitai account, haha. I'll see if I can figure it out and send you a request. Thanks again for all your patience!

jetsletmethehellin commented 2 weeks ago

Update: Resolved via Discord!