Closed 1blackbar closed 2 years ago
Oh, so sorry. I'll give pyreadline a try but it looks like it isn't actively supported any longer. If it doesn't work I'll simply disable readline functionality (which gives you command-line editing, etc) on systems that don't support GNU readline.
In the meantime, you could just delete all the lines of code that call readline functions and it should "just work" (tm)
I did it , removed history but now im getting error no module names ldm.simplet2i , and it wont run
Make sure that you are running python from the stable-diffusion directory. scripts and ldm should be subdirectories. Also check that the file ldm/simple2ti.py is present.
I just made a branch in which readline is disabled on machines that don't support it. Try checking out the branch named "noreadline-on-windows" and see if it behaves for you.
The file is present, i tried new branch and the issue is still the same, errors out with ldm.simplet2i , this file is not in main repo of original branch so i assume its the one you wrote , maybe its a windows thing that its not working, maybe youd have to load the t2i py file somehow first. Will this help in any way ? https://stackoverflow.com/questions/37233140/python-module-not-found
Yes, that's a module I added to the upstream distribution. It is getting loaded in dream.py's main() function, which is an unusual place for it, but I did it so that the help message would print out quickly. Could you try applying the enclosed patch to dream.py? All it does it to move two import statements from main() up to the top where these are usually located.
I'm so sorry for the trouble! I don't have access to a Windows machine with a GPU, so this is all a bit of trial and error patch.TXT.gz .
In case you can't gunzip and apply this patch, here it is in full. Just manually delete the two lines starting with "-" and add the two lines starting with "+" (without the - and + symbols)
--- scripts/dream.py 2022-08-18 15:59:31.607413000 -0400
+++ scripts/dream-test.py 2022-08-18 18:09:01.525402000 -0400
@@ -3,6 +3,8 @@
import shlex
import atexit
import os
+from pytorch_lightning import logging
+from ldm.simplet2i import T2I
# readline will be disabled on windows systems
try:
@@ -35,8 +37,6 @@
setup_readline()
print("* Initializing, be patient...\n")
- from pytorch_lightning import logging
- from ldm.simplet2i import T2I
# creating a simple text2image object with a handful of
# defaults passed on the command line.
The thing is i do it in notepad ++ i don have the tools to apply it as a patch So i should jst move the lines under print to header ? So its - import shlex import atexit import os from pytorch_lightning import logging from ldm.simplet2i import T2I
I did that (nothing else) and its still the same error about no module names ldm.simplet2i
Ok. I suspect it has something to do with casing on Windows. I'll have to rename the module. It won't take long, but I need to help my wife out with packing for a trip, so look for something later this evening.
Do You know any other quick way to just load mode l once and keep prompting like on discord ?
Oh, just a thought. Have you tried running the txt2img.py script that's part of the original distrib? If it loads its modules OK, then it's definitely a problem with my code.
yeh the original works without any issues, and img2img works as well so main branch code from original repo is fine over here
I'm going to convince my son to let me install python on his gaming Windows computer so I can test it out for myself. But this is an absolutely solvable problem. If you would, could you cut and paste the error messages you get when you run dream.py? Thx. Also, in the longer term, I'm sure there will be plenty of web and GUI-based Windows packages for you to run locally. I did this just 'cause I can't wait and enjoy a bit of hacking on the side.
(ldm) D:\stabot\scripts>python dream.py
Traceback (most recent call last):
File "dream.py", line 7, in
Do You know a way t o change original code so it would save the seed in image filename?
Sure. Tell me how you want the files named and I can do that. I'm working on my son's windows machine now and installing all the dependencies. Hopefully will reproduce your problem so I can fix.
Great, the names of the prompt and seed at the end, pretty much like on discord would work the best i think to go back and modify the image later keeping same seed On windows i had to pip some thigns myself cause entire yaml didn get trhough everything in it but its prettu straightforward installation, just opencv must be current one
Just finished install. I ran into a problem superficially similar to yours with the module not being found, but the easy solution was to replace "python3" with "python"
python3 scripts\dream.py -- did not work
python scripts\dream.py -- did work
But I doubt this is your problem because the original scripts are working fine for you. I'm using the Anaconda Powershell Prompt (miniconda3). Is this the same shell you're working with?
yes im on miniconda3 and i did used python , so your code works fine on windows over there ? Maybe i need python in PATH I cant use the powershell one, i had it closing immediately, some powershell issue mayube
Conda is supposed to take care of path issues, and if the path was an issue then it wouldn't be able to find ldm.util, which is in the same directory as ldm.simplet2i. Maybe there's something wonky in your directory structure? Do me a favor and cut-and-paste the output of "dir ldm":
(ldm) PS C:\Users\linco\Projects\SD\stable-diffusion> dir ldm
Directory: C:\Users\linco\Projects\SD\stable-diffusion\ldm
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2022-08-18 8:19 PM data
d----- 2022-08-18 8:19 PM models
d----- 2022-08-18 8:19 PM modules
-a---- 2022-08-18 8:19 PM 3980 lr_scheduler.py
-a---- 2022-08-18 8:19 PM 18097 simplet2i.py
-a---- 2022-08-18 8:19 PM 6056 util.py
Windows decided to do updates and its pretty slow now, i did not change anything with the structure, unpacked repo to STABOT folder on D drive and moved model to correct folder , its at 100% so ill post contents asap
No worries. This is probably not going to be helpful, but I'm running out of ideas. I appreciate your patience.
(base) D:\stabot>dir ldm Volume in drive D is Ai Volume Serial Number is 0A27-FD6B
Directory of D:\stabot\ldm
18/08/2022 23:35
Can You tell what python you have installed ? maybe if ill repeat your installation then it will run
OK fixed it! i had to move allyour python scripts to main folder ...
How do i switch to non PLMS sampler ? plms is slower than default one here Sometimes it kicks me out of the model by sayin range() arg 3 must not be zero
My prompt was - werewolf by frazetta -n 2 -s 57457 Id prefere if it wouldnt kick me out no matter what.
Wow! I'm so happy you got it figured out. You know, this reminds me that I had the same problem when I first installed the original source code (modules couldn't be found in their subdirectories, but only in main folder). It turned out that the Conda environment was borked. In that case, deleting all Conda's files and rebuilding did the trick.
When you launch the script, pass the option "--sampler ddim" to get the DDIM sampler. Unfortunately the k_lms sampler that the discord bot uses is not part of the upstream package. Presumably they will add it at some point and then I'll merge.
I will fix the code so that the sampler does not terminate the program, but just issues a message and returns to the command prompt. Did you mean -S 57457 in your example? Lowercase -s is number of steps, which would be crazy high.
The next time the plms sampler gives you an error please send the stack trace. I'm going to close the issue now. Feel free to reopen. I moved your request to add seed and prompt to filenames to a different issue tracker (it is issue #2)
OK fixed it! i had to move allyour python scripts to main folder ...
What do you mean by this? can I get a more step by step on that
Maybe it would be possible to use prompt_toolkit as an alternative. It works on Linux and Windows and should have all the features of readline, but it is also designed for making full on text user interfaces so it might be a bit overkill. Only ~380KiB though and in both pypi and conda repositories.
Can You make it work with pyreadline ? Its the only one for windows, but when i simply change readline to pyreadline in dream.py then i get atribute errror , pyreadline has not attribute ' read_history_file' Any way to get it working on win ??