Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kwai-Kolors node doesn't work - ChatGLMTokenizer._pad() got an unexpected keyword argument 'padding_side' #42

Open
ql0wn4 opened this issue Oct 9, 2024 · 8 comments

Comments

@ql0wn4
Copy link

ql0wn4 commented Oct 9, 2024

This is the error

ComfyUI Error Report

Error Details

  • Node Type: KolorsTextEncode
  • Exception Type: TypeError
  • Exception Message: ChatGLMTokenizer._pad() got an unexpected keyword argument 'padding_side'

Stack Trace

  File "E:\Stable-Diffusion\kolors\ComfyUI\execution.py", line 323, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)

  File "E:\Stable-Diffusion\kolors\ComfyUI\execution.py", line 198, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)

  File "E:\Stable-Diffusion\kolors\ComfyUI\execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)

  File "E:\Stable-Diffusion\kolors\ComfyUI\execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))

  File "E:\Stable-Diffusion\kolors\ComfyUI\custom_nodes\ComfyUI-KwaiKolorsWrapper\nodes.py", line 250, in encode
    text_inputs = tokenizer(

  File "E:\Stable-Diffusion\kolors\ComfyUI\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 3016, in __call__
    encodings = self._call_one(text=text, text_pair=text_pair, **all_kwargs)

  File "E:\Stable-Diffusion\kolors\ComfyUI\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 3104, in _call_one
    return self.batch_encode_plus(

  File "E:\Stable-Diffusion\kolors\ComfyUI\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 3306, in batch_encode_plus
    return self._batch_encode_plus(

  File "E:\Stable-Diffusion\kolors\ComfyUI\venv\lib\site-packages\transformers\tokenization_utils.py", line 889, in _batch_encode_plus
    batch_outputs = self._batch_prepare_for_model(

  File "E:\Stable-Diffusion\kolors\ComfyUI\venv\lib\site-packages\transformers\tokenization_utils.py", line 967, in _batch_prepare_for_model
    batch_outputs = self.pad(

  File "E:\Stable-Diffusion\kolors\ComfyUI\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 3522, in pad
    outputs = self._pad(

System Information

  • ComfyUI Version: v0.2.2-96-g203942c
  • Arguments: main.py --auto-launch
  • OS: nt
  • Python Version: 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
  • Embedded Python: false
  • PyTorch Version: 2.6.0.dev20241007+cu124

Devices

  • Name: cuda:0 NVIDIA GeForce RTX 3080 Ti : cudaMallocAsync
    • Type: cuda
    • VRAM Total: 12884377600
    • VRAM Free: 4774336448
    • Torch VRAM Total: 6811549696
    • Torch VRAM Free: 32675776

Logs

2024-10-09 13:15:03,033 - root - INFO - Total VRAM 12288 MB, total RAM 32682 MB
2024-10-09 13:15:03,034 - root - INFO - pytorch version: 2.6.0.dev20241007+cu124
2024-10-09 13:15:03,035 - root - INFO - Set vram state to: NORMAL_VRAM
2024-10-09 13:15:03,035 - root - INFO - Device: cuda:0 NVIDIA GeForce RTX 3080 Ti : cudaMallocAsync
2024-10-09 13:15:04,231 - root - INFO - Using pytorch cross attention
2024-10-09 13:15:05,379 - root - INFO - [Prompt Server] web root: E:\Stable-Diffusion\kolors\ComfyUI\web
2024-10-09 13:15:05,381 - root - INFO - Adding extra search path checkpoints E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/checkpoints/
2024-10-09 13:15:05,382 - root - INFO - Adding extra search path clip E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/clip/
2024-10-09 13:15:05,382 - root - INFO - Adding extra search path clip_interrogator E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/clip_interrogator/
2024-10-09 13:15:05,382 - root - INFO - Adding extra search path clip_vision E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/clip_vision/
2024-10-09 13:15:05,382 - root - INFO - Adding extra search path configs E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/configs/
2024-10-09 13:15:05,382 - root - INFO - Adding extra search path controlnet E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/controlnet/
2024-10-09 13:15:05,382 - root - INFO - Adding extra search path diffusers E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/diffusers/
2024-10-09 13:15:05,382 - root - INFO - Adding extra search path diffusion_models E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/diffusion_models/
2024-10-09 13:15:05,382 - root - INFO - Adding extra search path embeddings E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/embeddings/
2024-10-09 13:15:05,382 - root - INFO - Adding extra search path facerestore_models E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/facerestore_models/
2024-10-09 13:15:05,382 - root - INFO - Adding extra search path gligen E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/gligen/
2024-10-09 13:15:05,382 - root - INFO - Adding extra search path hypernetworks E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/hypernetworks/
2024-10-09 13:15:05,383 - root - INFO - Adding extra search path insightface E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/insightface
2024-10-09 13:15:05,383 - root - INFO - Adding extra search path LLM E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/LLM/
2024-10-09 13:15:05,383 - root - INFO - Adding extra search path llm_gguf E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/llm_gguf/
2024-10-09 13:15:05,383 - root - INFO - Adding extra search path loras E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/loras/
2024-10-09 13:15:05,383 - root - INFO - Adding extra search path photomaker E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/photomaker/
2024-10-09 13:15:05,383 - root - INFO - Adding extra search path style_models E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/style_models/
2024-10-09 13:15:05,383 - root - INFO - Adding extra search path unet E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/unet/
2024-10-09 13:15:05,383 - root - INFO - Adding extra search path upscale_models E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/upscale_models/
2024-10-09 13:15:05,383 - root - INFO - Adding extra search path vae E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/vae/
2024-10-09 13:15:05,383 - root - INFO - Adding extra search path vae_approx E:\Stable-Diffusion\ComfyUI_windows_portable_nvidia\ComfyUI\models/vae_approx/
2024-10-09 13:15:07,685 - root - INFO - 
Import times for custom nodes:
2024-10-09 13:15:07,685 - root - INFO -    0.0 seconds: E:\Stable-Diffusion\kolors\ComfyUI\custom_nodes\websocket_image_save.py
2024-10-09 13:15:07,685 - root - INFO -    0.2 seconds: E:\Stable-Diffusion\kolors\ComfyUI\custom_nodes\ComfyUI-KwaiKolorsWrapper
2024-10-09 13:15:07,685 - root - INFO -    0.3 seconds: E:\Stable-Diffusion\kolors\ComfyUI\custom_nodes\ComfyUI-Manager
2024-10-09 13:15:07,685 - root - INFO -    1.2 seconds: E:\Stable-Diffusion\kolors\ComfyUI\custom_nodes\comfyui-reactor-node
2024-10-09 13:15:07,685 - root - INFO - 
2024-10-09 13:15:07,691 - root - INFO - Starting server

2024-10-09 13:15:07,692 - root - INFO - To see the GUI go to: http://127.0.0.1:8188
2024-10-09 13:15:10,355 - root - INFO - got prompt
2024-10-09 13:15:10,369 - root - INFO - Using pytorch attention in VAE
2024-10-09 13:15:10,371 - root - INFO - Using pytorch attention in VAE
2024-10-09 13:15:20,668 - root - ERROR - !!! Exception during processing !!! ChatGLMTokenizer._pad() got an unexpected keyword argument 'padding_side'
2024-10-09 13:15:20,669 - root - ERROR - Traceback (most recent call last):
  File "E:\Stable-Diffusion\kolors\ComfyUI\execution.py", line 323, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
  File "E:\Stable-Diffusion\kolors\ComfyUI\execution.py", line 198, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
  File "E:\Stable-Diffusion\kolors\ComfyUI\execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)
  File "E:\Stable-Diffusion\kolors\ComfyUI\execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
  File "E:\Stable-Diffusion\kolors\ComfyUI\custom_nodes\ComfyUI-KwaiKolorsWrapper\nodes.py", line 250, in encode
    text_inputs = tokenizer(
  File "E:\Stable-Diffusion\kolors\ComfyUI\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 3016, in __call__
    encodings = self._call_one(text=text, text_pair=text_pair, **all_kwargs)
  File "E:\Stable-Diffusion\kolors\ComfyUI\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 3104, in _call_one
    return self.batch_encode_plus(
  File "E:\Stable-Diffusion\kolors\ComfyUI\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 3306, in batch_encode_plus
    return self._batch_encode_plus(
  File "E:\Stable-Diffusion\kolors\ComfyUI\venv\lib\site-packages\transformers\tokenization_utils.py", line 889, in _batch_encode_plus
    batch_outputs = self._batch_prepare_for_model(
  File "E:\Stable-Diffusion\kolors\ComfyUI\venv\lib\site-packages\transformers\tokenization_utils.py", line 967, in _batch_prepare_for_model
    batch_outputs = self.pad(
  File "E:\Stable-Diffusion\kolors\ComfyUI\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 3522, in pad
    outputs = self._pad(
TypeError: ChatGLMTokenizer._pad() got an unexpected keyword argument 'padding_side'

2024-10-09 13:15:20,670 - root - INFO - Prompt executed in 10.31 seconds
2024-10-09 13:15:24,027 - root - INFO - got prompt
2024-10-09 13:15:24,034 - root - ERROR - !!! Exception during processing !!! ChatGLMTokenizer._pad() got an unexpected keyword argument 'padding_side'
2024-10-09 13:15:24,034 - root - ERROR - Traceback (most recent call last):
  File "E:\Stable-Diffusion\kolors\ComfyUI\execution.py", line 323, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
  File "E:\Stable-Diffusion\kolors\ComfyUI\execution.py", line 198, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
  File "E:\Stable-Diffusion\kolors\ComfyUI\execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)
  File "E:\Stable-Diffusion\kolors\ComfyUI\execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
  File "E:\Stable-Diffusion\kolors\ComfyUI\custom_nodes\ComfyUI-KwaiKolorsWrapper\nodes.py", line 250, in encode
    text_inputs = tokenizer(
  File "E:\Stable-Diffusion\kolors\ComfyUI\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 3016, in __call__
    encodings = self._call_one(text=text, text_pair=text_pair, **all_kwargs)
  File "E:\Stable-Diffusion\kolors\ComfyUI\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 3104, in _call_one
    return self.batch_encode_plus(
  File "E:\Stable-Diffusion\kolors\ComfyUI\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 3306, in batch_encode_plus
    return self._batch_encode_plus(
  File "E:\Stable-Diffusion\kolors\ComfyUI\venv\lib\site-packages\transformers\tokenization_utils.py", line 889, in _batch_encode_plus
    batch_outputs = self._batch_prepare_for_model(
  File "E:\Stable-Diffusion\kolors\ComfyUI\venv\lib\site-packages\transformers\tokenization_utils.py", line 967, in _batch_prepare_for_model
    batch_outputs = self.pad(
  File "E:\Stable-Diffusion\kolors\ComfyUI\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 3522, in pad
    outputs = self._pad(
TypeError: ChatGLMTokenizer._pad() got an unexpected keyword argument 'padding_side'

2024-10-09 13:15:24,035 - root - INFO - Prompt executed in 0.01 seconds

Attached Workflow

Please make sure that workflow does not contain any sensitive information such as API keys or passwords.

{"last_node_id":15,"last_link_id":18,"nodes":[{"id":10,"type":"VAEDecode","pos":{"0":1368,"1":369},"size":{"0":210,"1":46},"flags":{},"order":6,"mode":0,"inputs":[{"name":"samples","type":"LATENT","link":18},{"name":"vae","type":"VAE","link":12,"slot_index":1}],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[13],"slot_index":0,"shape":3}],"properties":{"Node name for S&R":"VAEDecode"},"widgets_values":[]},{"id":14,"type":"KolorsSampler","pos":{"0":1011,"1":371},"size":{"0":315,"1":266},"flags":{},"order":5,"mode":0,"inputs":[{"name":"kolors_model","type":"KOLORSMODEL","link":16},{"name":"kolors_embeds","type":"KOLORS_EMBEDS","link":17},{"name":"latent","type":"LATENT","link":null,"shape":7}],"outputs":[{"name":"latent","type":"LATENT","links":[18],"slot_index":0,"shape":3}],"properties":{"Node name for S&R":"KolorsSampler"},"widgets_values":[1024,1024,1000102404233412,"fixed",25,5,"EulerDiscreteScheduler",1]},{"id":6,"type":"DownloadAndLoadKolorsModel","pos":{"0":201,"1":368},"size":{"0":315,"1":82},"flags":{},"order":0,"mode":0,"inputs":[],"outputs":[{"name":"kolors_model","type":"KOLORSMODEL","links":[16],"slot_index":0,"shape":3}],"properties":{"Node name for S&R":"DownloadAndLoadKolorsModel"},"widgets_values":["Kwai-Kolors/Kolors","fp16"]},{"id":3,"type":"PreviewImage","pos":{"0":1366,"1":468},"size":{"0":535.400146484375,"1":562.2001342773438},"flags":{},"order":7,"mode":0,"inputs":[{"name":"images","type":"IMAGE","link":13}],"outputs":[],"properties":{"Node name for S&R":"PreviewImage"},"widgets_values":[]},{"id":12,"type":"KolorsTextEncode","pos":{"0":519,"1":529},"size":{"0":457.28936767578125,"1":225.28656005859375},"flags":{},"order":4,"mode":0,"inputs":[{"name":"chatglm3_model","type":"CHATGLM3MODEL","link":14,"slot_index":0}],"outputs":[{"name":"kolors_embeds","type":"KOLORS_EMBEDS","links":[17],"slot_index":0,"shape":3}],"properties":{"Node name for S&R":"KolorsTextEncode"},"widgets_values":["cinematic photograph of an astronaut riding a horse in space |\nillustration of a cat wearing a top hat and a scarf  |\nphotograph of a goldfish in a bowl |\nanime screencap of a red haired girl","",1]},{"id":15,"type":"Note","pos":{"0":200,"1":636},"size":{"0":273.5273742675781,"1":149.5546417236328},"flags":{},"order":1,"mode":0,"inputs":[],"outputs":[],"properties":{"text":""},"widgets_values":["Text encoding takes the most VRAM, quantization can reduce that a lot.\n\nApproximate values I have observed:\nfp16 - 12 GB\nquant8 - 8-9 GB\nquant4 - 4-5 GB\n\nquant4 reduces the quality quite a bit, 8 seems fine"],"color":"#432","bgcolor":"#653"},{"id":13,"type":"DownloadAndLoadChatGLM3","pos":{"0":206,"1":522},"size":{"0":274.5334167480469,"1":58},"flags":{},"order":2,"mode":0,"inputs":[],"outputs":[{"name":"chatglm3_model","type":"CHATGLM3MODEL","links":[14],"shape":3}],"properties":{"Node name for S&R":"DownloadAndLoadChatGLM3"},"widgets_values":["quant8"]},{"id":11,"type":"VAELoader","pos":{"0":1323,"1":240},"size":{"0":315,"1":58},"flags":{},"order":3,"mode":0,"inputs":[],"outputs":[{"name":"VAE","type":"VAE","links":[12],"shape":3}],"properties":{"Node name for S&R":"VAELoader"},"widgets_values":["sdxl_vae.safetensors"]}],"links":[[12,11,0,10,1,"VAE"],[13,10,0,3,0,"IMAGE"],[14,13,0,12,0,"CHATGLM3MODEL"],[16,6,0,14,0,"KOLORSMODEL"],[17,12,0,14,1,"KOLORS_EMBEDS"],[18,14,0,10,0,"LATENT"]],"groups":[],"config":{},"extra":{"ds":{"scale":1,"offset":[0,0]}},"version":0.4}

Additional Context

(Please add any additional context or steps to reproduce the error here)

@gtbloody
Copy link

me too

@hackyinge
Copy link

I also encountered the above problem and the problem has been solved. It's a problem with the transformers version, check if the transformers in your environment are greater than 4.26.1 of the dependency, and report the above error if it is less than that. Uninstall the transformers and install the transformers that meet the requirements. Encourage everyone.

pip show transformers to see the version
pip install transformers==4.26.1安装合适的版本。
这里有个坑,虽然你使用 pip install transformers>=4.26.1 命令期望安装 4.26.1 或更高版本,但实际可能安装的是 4.45.2 版本。这是因为 pip 默认会安装最新版本的软件包,除非你明确指定版本号。

@gtbloody
Copy link

I also encountered the above problem and the problem has been solved. It's a problem with the transformers version, check if the transformers in your environment are greater than 4.26.1 of the dependency, and report the above error if it is less than that. Uninstall the transformers and install the transformers that meet the requirements. Encourage everyone.

pip show transformers to see the version pip install transformers==4.26.1安装合适的版本。 这里有个坑,虽然你使用 pip install transformers>=4.26.1 命令期望安装 4.26.1 或更高版本,但实际可能安装的是 4.45.2 版本。这是因为 pip 默认会安装最新版本的软件包,除非你明确指定版本号。

我的transformers确实是4.45.2,我试了 4.26.1,要动一堆其他依赖,还是改回4.45.2了

@githubcto
Copy link
Contributor

#43
Fix TypeError: ChatGLMTokenizer._pad() got an unexpected keyword argument 'padding_side'

confirmed comfyUI using transformers-4.45.2

@hackyinge
Copy link

hackyinge commented Oct 20, 2024

I also encountered the above problem and the problem has been solved. It's a problem with the transformers version, check if the transformers in your environment are greater than 4.26.1 of the dependency, and report the above error if it is less than that. Uninstall the transformers and install the transformers that meet the requirements. Encourage everyone.
pip show transformers to see the version pip install transformers==4.26.1安装合适的版本。 这里有个坑,虽然你使用 pip install transformers>=4.26.1 命令期望安装 4.26.1 或更高版本,但实际可能安装的是 4.45.2 版本。这是因为 pip 默认会安装最新版本的软件包,除非你明确指定版本号。

我的transformers确实是4.45.2,我试了 4.26.1,要动一堆其他依赖,还是改回4.45.2了

你使用这个工作流试试,这个应该行
kolors-文生图.json

@hackyinge
Copy link

kolors-文生图.json

@gtbloody
Copy link

I also encountered the above problem and the problem has been solved. It's a problem with the transformers version, check if the transformers in your environment are greater than 4.26.1 of the dependency, and report the above error if it is less than that. Uninstall the transformers and install the transformers that meet the requirements. Encourage everyone.
pip show transformers to see the version pip install transformers==4.26.1安装合适的版本。 这里有个坑,虽然你使用 pip install transformers>=4.26.1 命令期望安装 4.26.1 或更高版本,但实际可能安装的是 4.45.2 版本。这是因为 pip 默认会安装最新版本的软件包,除非你明确指定版本号。

我的transformers确实是4.45.2,我试了 4.26.1,要动一堆其他依赖,还是改回4.45.2了

你使用这个工作流试试,这个应该行 kolors-文生图.json

楼上贡献者已经修复了这个问题了

@liqianlun
Copy link

这个新工作流真的解决大问题了,实测可用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants