ahrm / UnstableFusion

A Stable Diffusion desktop frontend with inpainting, img2img and more!
GNU General Public License v3.0
1.26k stars 86 forks source link

'NoneType' object has no attribute 'width' #6

Closed ZeroCool22 closed 2 years ago

ZeroCool22 commented 2 years ago
C:\Users\ZeroCool22\Desktop\UnstableFusion\UnstableFusion>python unstablefusion.py
'NoneType' object has no attribute 'width'
'NoneType' object has no attribute 'width'
Traceback (most recent call last):
  File "C:\Users\ZeroCool22\Desktop\UnstableFusion\UnstableFusion\unstablefusion.py", line 565, in mousePressEvent
    top_left = QPoint(e.pos().x() - self.selection_rectangle_size[0] / 2, e.pos().y() - self.selection_rectangle_size[1] / 2)
TypeError: arguments did not match any overloaded call:
  QPoint(): too many arguments
  QPoint(int, int): argument 1 has unexpected type 'float'
  QPoint(QPoint): argument 1 has unexpected type 'float'

C:\Users\ZeroCool22\Desktop\UnstableFusion\UnstableFusion>

https://user-images.githubusercontent.com/13344308/191976776-ab6a9235-a799-4ea8-9158-d7e3a55325f5.mp4

And just doing a Click on the Canvas, gives an error too and close it by itself.

https://user-images.githubusercontent.com/13344308/191977180-b545d36c-af42-446a-a1c8-6a948e1c173f.mp4

ahrm commented 2 years ago

You must select a target square before trying to generate.

ZeroCool22 commented 2 years ago

You must select a target square before trying to generate.

Look the second video when i try to click the canvas i get error too...

ahrm commented 2 years ago

Are you sure you are using the latest commits? This line of code should be different in the latest commits.

ZeroCool22 commented 2 years ago

Are you sure you are using the latest commits? This line of code should be different in the latest commits.

Let me do a GIT PULL and i will try again..

ZeroCool22 commented 2 years ago

Ok:

C:\Users\ZeroCool22\Desktop\UnstableFusion\UnstableFusion>python unstablefusion.py
'NoneType' object has no attribute 'width'
You specified use_auth_token=True, but a Hugging Face token was not found.

I need a Token to Run it locally?

ahrm commented 2 years ago

Yes, you need to run a stable diffusion notebook locally once (so that your token is cached) for example this: https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/stable_diffusion.ipynb (download it and run it locally using jupyter notebook). After that you will be able to use unstablefusion.

ZeroCool22 commented 2 years ago

Yes, you need to run a stable diffusion notebook locally once (so that your token is cached) for example this: https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/stable_diffusion.ipynb (download it and run it locally using jupyter notebook). After that you will be able to use unstablefusion.

I have never run a Jupiter Notebook before. I just download it and now it opened in Studio Code:

Screenshot_24

Now i run every cell?

ZeroCool22 commented 2 years ago

Ok, and now?:

Screenshot_25

ahrm commented 2 years ago

Click on the note book and run the cells one-by-one. You probably won't need to run some of them like these:

!pip install diffusers==0.3.0
!pip install transformers scipy ftfy
!pip install "ipywidgets>=7,<8"

which are just installing the packages that you already have.

Also you don't need to run the colab-specific ones like this:

from google.colab import output
output.enable_custom_widget_manager()

The main cell that you have to run is this:

from huggingface_hub import notebook_login

notebook_login()
ZeroCool22 commented 2 years ago

Click on the note book and run the cells one-by-one. You probably won't need to run some of them like these:

!pip install diffusers==0.3.0
!pip install transformers scipy ftfy
!pip install "ipywidgets>=7,<8"

which are just installing the packages that you already have.

Also you don't need to run the colab-specific ones like this:

from google.colab import output
output.enable_custom_widget_manager()

The main cell that you have to run is this:

from huggingface_hub import notebook_login

notebook_login()

Screenshot_26

Still getting the You specified use_auth_token=True, but a Hugging Face token was not found.

ahrm commented 2 years ago

It may be a good idea to continue running the notebook until a stable diffusion pipeline is created.

ahrm commented 2 years ago

Or you can edit the files and replace

use_auth_token=True

with

use_auth_token='<your huggingface token>'
ZeroCool22 commented 2 years ago

Well, after downloading a lot of things this comes out..

Screenshot_27

ZeroCool22 commented 2 years ago

Or you can edit the files and replace

use_auth_token=True

with

use_auth_token='<your huggingface token>'

In what file i modify that?

ahrm commented 2 years ago

diffusionserver.py

ZeroCool22 commented 2 years ago

This one?

Screenshot_28

use_auth_token=True).to("cuda")

For this?:

use_auth_token='xxxxxxxxxxxx').to("cuda")

ahrm commented 2 years ago

Yes, however, I have made a version that has a field in the UI for huggingface token. I will upload it in a few minutes. You may want to wait for that.

ahrm commented 2 years ago

Added in aa5ffd5d34766df4197ecc376e701ed3cd688657.

ZeroCool22 commented 2 years ago

C:\Users\ZeroCool22\Desktop\UnstableFusion\UnstableFusion>python unstablefusion.py {'trained_betas'} was not found in config. Values will be initialized to default values. Torch not compiled with CUDA enabled

ahrm commented 2 years ago

Well, you need pytorch with cuda enabled for stablediffusion. See the pytorch website for how to install pytorch with cuda enabled.

ZeroCool22 commented 2 years ago

Yes, however, I have made a version that has a field in the UI for huggingface token. I will upload it in a few minutes. You may want to wait for that.

Yeah!

Was about to tell if there wasn't a more easy way to handle the Token in the interface...

But what about the Torch error? :(

C:\Users\ZeroCool22\Desktop\UnstableFusion\UnstableFusion>python unstablefusion.py
{'trained_betas'} was not found in config. Values will be initialized to default values.
Torch not compiled with CUDA enabled
ahrm commented 2 years ago

Well, you need pytorch with cuda enabled for stablediffusion. See the pytorch website for how to install pytorch with cuda enabled.

ZeroCool22 commented 2 years ago

install pytorch with cuda

This could be included in the requirements.txt?

ahrm commented 2 years ago

The thing is, you don't need this if you intend to run it with google colab.

ZeroCool22 commented 2 years ago

The thing is, you don't need this if you intend to run it with google colab.

Yeah, but i always prefer run it locally! So use my own GPU....

ZeroCool22 commented 2 years ago

Screenshot_29

What i should put here?

ahrm commented 2 years ago

You could just clone the repository from scratch (this is conflicting with the changes you have done, for example your hugginface token, in the new version we have a UI field for that so there is no need for your change anymore)

ZeroCool22 commented 2 years ago

Can you help me with the Pytorch with CUDA install please?

https://pytorch.org/get-started/locally/

This will work?:

pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113

ahrm commented 2 years ago

Yes.

ZeroCool22 commented 2 years ago

Yes.

Screenshot_31

Well, i don't know what more to do...

ahrm commented 2 years ago

Did you install cuda itself?

ZeroCool22 commented 2 years ago

Did you install cuda itself?

Screenshot_32

I used this command

pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113

inside:

C:\Users\ZeroCool22\Desktop\UnstableFusion\UnstableFusion

ahrm commented 2 years ago

Your cuda version is too recent! You installed pytorch with cuda 11.3 but you have cuda 11.7. (I think pytorch only supports up to cuda 11.6)

ZeroCool22 commented 2 years ago

Your cuda version is too recent! You installed pytorch with cuda 11.3 but you have cuda 11.7. (I think pytorch only supports up to cuda 11.6)

How uninstall it?

Just from control panel? or must be from the console?

ahrm commented 2 years ago

I don't think you need to uninstall anything. Just install the other version. (not sure though)

ZeroCool22 commented 2 years ago

I don't think you need to uninstall anything. Just install the other version. (not sure though)

Screenshot_33

I tried with 3 different version, but when i run the command nvidia-smi still saying 11.7.

I used the command

: pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113

But it still says 11.7.

ahrm commented 2 years ago

You probably need to add the correct cuda version's bin directory to PATH and remove the old one from the PATH.

ZeroCool22 commented 2 years ago

You probably need to add the correct cuda version's bin directory to PATH and remove the old one from the PATH.

I installed the 11.3.

My PATHS are fine:

capture

Screenshot_34

But i still get: Torch not compiled with CUDA enabled

What i do, i should try to install Tensoroflow?

ahrm commented 2 years ago

I am not sure. I would say at this point your issue is a pytorch issue rather than unstablefusion issue. You may find better help in pytorch forums, I am not really an expert on this.

ZeroCool22 commented 2 years ago

Finally, working...

Screenshot_35

This can be ignored?:

{'trained_betas'} was not found in config. Values will be initialized to default values.

ahrm commented 2 years ago

Yes, that is not a problem.