castorini / daam

Diffusion attentive attribution maps for interpreting Stable Diffusion.
MIT License
669 stars 61 forks source link

TypeError: FrozenCLIPEmbedderWithCustomWordsBase.tokenize_line() takes 2 positional arguments but 4 were given #30

Closed burkan2 closed 1 year ago

burkan2 commented 1 year ago

I've tried the DAAM with a lot of models and lots of promts, tried re-installing clean Automatic1111 folder too, the issue stayed consistent:

TypeError: FrozenCLIPEmbedderWithCustomWordsBase.tokenize_line() takes 2 positional arguments but 4 were given

If you can help it would be much appreciated

daemon commented 1 year ago

What version of transformers do you have? Can you paste your pip list?

C0rn3j commented 1 year ago

transformers 4.25.1, as per SD reqs.

Upgrading to currently latest 4.27.3 does not help.

Traceback (most recent call last):
  File "/root/stable-diffusion-webui/modules/call_queue.py", line 56, in f
    res = list(func(*args, **kwargs))
  File "/root/stable-diffusion-webui/modules/call_queue.py", line 37, in f
    res = func(*args, **kwargs)
  File "/root/stable-diffusion-webui/modules/txt2img.py", line 53, in txt2img
    processed = modules.scripts.scripts_txt2img.run(p, *args)
  File "/root/stable-diffusion-webui/modules/scripts.py", line 407, in run
    processed = script.run(p, *script_args)
  File "/root/stable-diffusion-webui/extensions/stable-diffusion-webui-daam/scripts/daam_script.py", line 118, in run
    prompt_analyzer = utils.PromptAnalyzer(embedder, styled_prompt)
  File "/root/stable-diffusion-webui/extensions/stable-diffusion-webui-daam/scripts/daam/utils.py", line 274, in __init__
    remade_tokens, fixes, multipliers, token_count = self.tokenize_line(text, used_custom_terms=self.used_custom_terms, hijack_comments=self.hijack_comments)
  File "/root/stable-diffusion-webui/extensions/stable-diffusion-webui-daam/scripts/daam/utils.py", line 290, in tokenize_line
    remade_tokens, fixes, multipliers, token_count = self.clip.tokenize_line(line, used_custom_terms, hijack_comments)
TypeError: FrozenCLIPEmbedderWithCustomWordsBase.tokenize_line() takes 2 positional arguments but 4 were given
absl-py                  1.3.0                                                                                                                                                                                                                                                                                              
accelerate               0.12.0                                                                                                                                                                                                                                                                                             
addict                   2.4.0                                                                                                                                                                                                                                                                                              
aenum                    3.1.11                                                                                                                                                                                                                                                                                             
aiofiles                 22.1.0                                                                                                                                                                                                                                                                                             
aiohttp                  3.8.3                                                                                                                                                                                                                                                                                              
aiosignal                1.3.1                                                                                                                                                                                                                                                                                              
altair                   4.2.0                                                                                                                                                                                                                                                                                              
antlr4-python3-runtime   4.9.3                                                                                                                                                                                                                                                                                              
anyio                    3.6.2                                                                                                                                                                                                                                                                                              
async-timeout            4.0.2                                                                                                                                                                                                                                                                                              
attrs                    22.2.0                                                                                                                                                                                                                                                                                             
basicsr                  1.4.2                                                                                                                                                                                                                                                                                              
beautifulsoup4           4.11.1                                                                                                                                                                                                                                                                                             
blendmodes               2022                                                                                                                                                                                                                                                                                               
boltons                  21.0.0                                                                                                                                                                                                                                                                                             
cachetools               5.2.0                                                                                                                                                                                                                                                                                              
certifi                  2022.12.7                                                                                                                                                                                                                                                                                          
chardet                  4.0.0                                                                                                                                                                                                                                                                                              
charset-normalizer       2.1.1                                                                                                                                                                                                                                                                                              
clean-fid                0.1.29                                                                                                                                                                                                                                                                                             
click                    8.1.3                                                                                                                                                                                                                                                                                              
clip                     1.0                                                                                                                                                                                                                                                                                                
cmake                    3.25.0                                                                                                                                                                                                                                                                                             
coloredlogs              15.0.1                                                                                                                                                                                                                                                                                             
contourpy                1.0.6                                                                                                                                                                                                                                                                                              
cycler                   0.11.0                                                                                                                                                                                                                                                                                             
deprecation              2.1.0                                                                                                                                                                                                                                                                                              
einops                   0.4.1                                                                                                                                                                                                                                                                                              
entrypoints              0.4                                                                                                                                                                                                                                                                                                
facexlib                 0.2.5                                                                                                                                                                                                                                                                                              
fairscale                0.4.4                                                                                                                                                                                                                                                                                              
fastapi                  0.94.0                                                                                                                                                                                                                                                                                             
ffmpy                    0.3.0                                                                                                                                                                                                                                                                                              
filelock                 3.9.0                                                                                                                                                                                                                                                                                              
filterpy                 1.4.5                                                                                                                                                                                                                                                                                              
flatbuffers              22.12.6                                                                                                                                                                                                                                                                                            
font-roboto              0.0.1                                                                                                                                                                                                                                                                                              
fonts                    0.0.3                                                                                                                                                                                                                                                                                              
fonttools                4.38.0                                                                                                                                                                                                                                                                                             
frozenlist               1.3.3                                                                                                                                                                                                                                                                                              
fsspec                   2022.11.0                                                                                                                                                                                                                                                                                          
ftfy                     6.1.1                                                                                                                                                                                                                                                                                              
future                   0.18.2                                                                                                                                                                                                                                                                                             
gdown                    4.6.0                                                                                                                                                                                                                                                                                              
gfpgan                   1.3.8                                                                                                                                                                                                                                                                                              
gitdb                    4.0.10                                                                                                                                                                                                                                                                                             
GitPython                3.1.30                                                                                                                                                                                                                                                                                             
google-auth              2.15.0                                                                                                                                                                                                                                                                                             
google-auth-oauthlib     0.4.6                                                                                                                                                                                                                                                                                              
gradio                   3.23.0                                                                                                                                                                                                                                                                                             
grpcio                   1.51.1                                                                                                                                                                                                                                                                                             
h11                      0.12.0                                                                                                                                                                                                                                                                                             
httpcore                 0.15.0                                                                                                                                                                                                                                                                                             
httpx                    0.23.2                                                                                                                                                                                                                                                                                             
huggingface-hub          0.13.3                                                                                                                                                                                                                                                                                             
humanfriendly            10.0                                                                                                                                                                                                                                                                                               
idna                     2.10                                                  
imageio                  2.23.0                                                
inflection               0.5.1                                                 
invisible-watermark      0.1.5                                                 
Jinja2                   3.1.2                                                 
jsonmerge                1.8.0                                                 
jsonschema               4.17.3                                                
kiwisolver               1.4.4                                                 
kornia                   0.6.7                                                 
lark                     1.1.2                                                 
lightning-utilities      0.8.0                                                 
linkify-it-py            1.0.3                                                 
lit                      16.0.0                                                
llvmlite                 0.39.1                                                
lmdb                     1.4.0                                                 
lpips                    0.1.4                                                 
Markdown                 3.4.1                                                 
markdown-it-py           2.2.0                                                 
MarkupSafe               2.1.1                                                 
matplotlib               3.6.2                                                 
mdit-py-plugins          0.3.3                                                 
mdurl                    0.1.2                                                 
mpmath                   1.2.1                                                 
multidict                6.0.4                                                 
mypy-extensions          0.4.3                                                 
networkx                 2.8.8                                                 
ninja                    1.11.1                                                
numba                    0.56.4                                                
numpy                    1.23.3                                                
nvidia-cublas-cu11       11.11.3.6                                             
nvidia-cuda-nvrtc-cu11   11.8.89                                               
nvidia-cuda-nvrtc-cu12   12.1.55                                               
nvidia-cuda-runtime-cu11 11.8.89                                               
nvidia-cudnn-cu11        8.8.1.3                                               
oauthlib                 3.2.2                                                 
omegaconf                2.2.3                                                 
onnx                     1.13.0                                                
onnxruntime              1.13.1                                                
open-clip-torch          2.9.1                                                 
opencv-contrib-python    4.7.0.72                                              
opencv-python            4.7.0.68                                              
orjson                   3.8.3                                                 
packaging                22.0                                                  
pandas                   1.5.2                                                 
piexif                   1.1.3                                                 
Pillow                   9.4.0                                                 
pip                      22.3.1                                                
protobuf                 3.20.3                                                
psutil                   5.9.4                                                 
pyasn1                   0.4.8                                                 
pyasn1-modules           0.2.8                                                 
pycryptodome             3.16.0                                                
pydantic                 1.10.4                                                
pyDeprecate              0.3.2                                                 
pydub                    0.25.1                                                
Pygments                 2.14.0                                                
pyparsing                3.0.9                                                 
pyre-extensions          0.0.23                                                
pyrsistent               0.19.3                                                
PySocks                  1.7.1                                                 
python-dateutil          2.8.2                                                 
python-multipart         0.0.4                                                 
pytorch-lightning        1.9.4                                                 
pytz                     2022.7                                                
PyWavelets               1.4.1                                                 
PyYAML                   6.0                                                   
realesrgan               0.3.0                                                 
regex                    2022.10.31                                            
requests                 2.25.1                                                
requests-oauthlib        1.3.1                                                 
resize-right             0.0.2                                                 
rfc3986                  1.5.0                                                 
rich                     13.3.2                                                
rsa                      4.9                                                   
safetensors              0.3.0                                                 
scikit-image             0.19.2                                                
scipy                    1.9.3                                                 
semantic-version         2.10.0                                                
sentencepiece            0.1.97                                                
setuptools               65.5.0                                                
six                      1.16.0                                                
smmap                    5.0.0                                                 
sniffio                  1.3.0                                                 
soupsieve                2.3.2.post1                                           
starlette                0.26.1                                                
sympy                    1.11.1                                                
tb-nightly               2.12.0a20230102                                       
tensorboard              2.11.0                                                
tensorboard-data-server  0.6.1                                                 
tensorboard-plugin-wit   1.8.1                                                 
tifffile                 2022.10.10                                            
timm                     0.6.7                                                 
tokenizers               0.12.1                                                
toolz                    0.12.0                                                
torch                    2.0.0+cu118                                           
torchdiffeq              0.2.3                                                 
torchmetrics             0.11.0                                                
torchsde                 0.2.5                                                 
torchvision              0.15.1+cu118                                          
tqdm                     4.64.1                                                
trampoline               0.1.2                                                 
transformers             4.25.1                                                
triton                   2.0.0                                                 
typing_extensions        4.4.0                                                 
typing-inspect           0.8.0                                                 
uc-micro-py              1.0.1                                                 
urllib3                  1.26.13                                               
uvicorn                  0.20.0                                                
wcwidth                  0.2.5                                                 
websockets               10.4                                                  
Werkzeug                 2.2.2                                                 
wheel                    0.38.4                                                
xformers                 0.0.15+e163309.d20230103 /root/stable-diffusion-webui/repositories/xformers                                                          
yapf                     0.32.0                                                
yarl                     1.8.2                                                 
daemon commented 1 year ago

I see, I'll update it to work with transformers 4.25. Under the current DAAM requirements, it works with Transformers 4.24.0:

https://github.com/castorini/daam/blob/main/requirements.txt#L6

daemon commented 1 year ago

Updated.

Please reopen if it persists.