Comments (9)
I had a chance to try the corrected repo, and everything works without issue. I also tested using multiple embeddings, which seems to work quite well (the embedding mapping is poor, but both seem to be contributing to generation).
from stable-diffusion-webui.
Which repository are you using for Stable Diffusion?
from stable-diffusion-webui.
This one, as per the linked guide in your readme. https://github.com/hlky/stable-diffusion
I then copied your webui.py
script into the main directory, and added an embeddings
sub-directory.
from stable-diffusion-webui.
I just cloned it and tested my embedding in it, works perfectly. What embedding are you using? Also post the full error message, maybe that will help.
from stable-diffusion-webui.
I am using a custom embedding trained from textual inversion. I can give the one you posted a try as well in the event that there's something off with the file itself (though they two look very similar).
Is it possible that there's some environmental issue? I am using anaconda (not miniconda), a new environment ("ldo" instead of "ldm"), and I changed the lightning version to 1.5.0 as per another guide with vanilla SD.
Here's the full trace, though I had to redact some of the paths.
To create a public link, set `share=True` in `launch()`.
Loaded a total of 1 text inversion embeddings.
Traceback (most recent call last):
File "<profile>\anaconda3\envs\ldo\lib\site-packages\gradio\routes.py", line 247, in run_predict
output = await app.blocks.process_api(
File "<profile>\anaconda3\envs\ldo\lib\site-packages\gradio\blocks.py", line 641, in process_api
predictions, duration = await self.call_function(fn_index, processed_input)
File "<profile>\anaconda3\envs\ldo\lib\site-packages\gradio\blocks.py", line 554, in call_function
prediction = await block_fn.fn(*processed_input)
File "<profile>\anaconda3\envs\ldo\lib\site-packages\gradio\interface.py", line 651, in submit_func
prediction = await self.run_prediction(args)
File "<profile>\anaconda3\envs\ldo\lib\site-packages\gradio\interface.py", line 680, in run_prediction
prediction = await anyio.to_thread.run_sync(
File "<profile>\anaconda3\envs\ldo\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "<profile>\anaconda3\envs\ldo\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "<profile>\anaconda3\envs\ldo\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
result = context.run(func, *args)
File "webui.py", line 378, in f
res = list(func(*p1, **p2))
File "webui.py", line 677, in txt2img
output_images, seed, info = process_images(
File "webui.py", line 613, in process_images
uc = model.get_learned_conditioning(len(prompts) * [""])
File "F:\webSD\stable-diffusion-main\ldm\models\diffusion\ddpm.py", line 594, in get_learned_conditioning
c = self.cond_stage_model(c)
File "<profile>\anaconda3\envs\ldo\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "webui.py", line 516, in forward
z = outputs.last_hidden_state
AttributeError: 'Tensor' object has no attribute 'last_hidden_state'
from stable-diffusion-webui.
Can you add three lines to you webui.py around line 516 so that it looks like this:
tokens = torch.asarray(remade_batch_tokens).to(self.wrapped.device)
print(type(self.wrapped))
print(type(self.wrapped.transformer))
outputs = self.wrapped.transformer(input_ids=tokens)
print(type(outputs))
z = outputs.last_hidden_state
return z
And report what's printed in the command line?
from stable-diffusion-webui.
Sure, but it might have to wait until tomorrow. I am currently doing a very slow embedding training and textual inversion currently has no way to restart from a checkpoint.
Also, if it helps, using an embedding with the other webui.py (from the repo I mentioned above) seems to work without issue, though it only supports a single embedding file, and your method for ensuring that the embedding is used makes far more sense to me.
I will post the printout when I get a chance to run it.
from stable-diffusion-webui.
File "F:\webSD\stable-diffusion-main\ldm\models\diffusion\ddpm.py", line 594, in get_learned_conditioning
c = self.cond_stage_model(c)
Here's line 594 of that file in the repo you linked:
https://github.com/hlky/stable-diffusion/blob/main/ldm/models/diffusion/ddpm.py#L594
Line with c = self.cond_stage_model(c)
from the stack is:
https://github.com/hlky/stable-diffusion/blob/main/ldm/models/diffusion/ddpm.py#L558
Looks to me like you have a different repo.
from stable-diffusion-webui.
I think I see what happened now...
Those files differ because they were replaced by https://github.com/hlky/sd-enable-textual-inversion
The original repo that I linked pointed to the sd-enable-textual-inversion
repo to enable embeddings. However, your solution likely conflicts with the modification there, which could be causing the issue.
Given that you verified your method working with the first repo link (without the sd-enable
update), I will first create a clean repo without it, and try your webui.py
implementation. If that still crashes, then I will add the printouts and reply with the result.
I am going to keep the same ldo
environment though, which was not modified by adding the sd-enable
fix.
from stable-diffusion-webui.
Related Issues (20)
- [Bug]: Disappeared "DPM++ 2M Karras" HOT 2
- [Bug]: CONSTANT crash to black screen. RX 6800
- [Bug]: CPU is being used instead of GPU for AMD 7800xt on Arch Linux
- [Feature Request]: No Image data blocks found HOT 1
- API calls in version 1.8 cannot pass input images in the format of http://, https://[Bug]:
- The image generated by the paint upload has a black background HOT 6
- [Bug]: Installing controlnet extension breaks WebUI HOT 25
- EinopsError: Error while processing rearrange-reduction pattern while using AnimateDiff
- [Bug]: 'no module 'xformers'. Processing without' on fresh installation of v1.9.0 HOT 5
- [Bug]: TimeoutError/error code: 2/Couldn't install torch HOT 9
- [Bug]: ControlNet breaks my WebUI HOT 10
- [Bug]: clone main, but webui can't complete installation: error pydantic HOT 1
- [Bug]: No visible mov2mov and others features like reactor HOT 2
- Fix: Control-Net; ImportError; Undefined; pydantic; insightface
- [Bug]: Linux: SDXL-based models fail to load, PyTorch error HOT 4
- [Bug]: Unable to select a checkpoint model when starting from a clean or existing installation. HOT 6
- [Dev PSA] PyCharm >= 2023.3.3 Debugger possible issue
- [Bug]: NameError loading styles.py (initializing the StyleDatabase) on dev branch HOT 2
- [Bug]: Any error happening after 'commit hash : XXXX' is not related to the launcher. Please report them on Automatic1111's github instead : HOT 1
- [Feature Request]: Add a scheduler pattern to the filename save options now that it has been removed from the sampler in 1.9.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stable-diffusion-webui.