AttributeError: 'NoneType' object has no attribute 'shape'
'NoneType' object has no attribute 'size'
'NoneType' object has no attribute 'reshape' error when using ReActor node
python - Scale and Save Images (AttributeError: 'NoneType' object has no attribute 'shape') - Stack Overflow
hello, i am relatively new to comfyui and found this ReActor node to swap faces. I tried it and got this error: NoneType object has no attribute reshape. I realy dont know how to fix this. I have reinstalled the ReActor node several times but nothing helped. I checked the dependencies and made sure everything is installed. I googled the error but found nothing. Please help. I am stuck at this for 2 weeks now.
[ReActor] 12:22:51 - STATUS - Checking for any unsafe content
[ReActor] 12:22:52 - STATUS - Working: source face index [0], target face index [0]
[ReActor] 12:22:52 - STATUS - Using Hashed Source Face(s) Model...
[ReActor] 12:22:52 - STATUS - Using Hashed Target Face(s) Model...
[ReActor] 12:22:52 - STATUS - Swapping...
!!! Exception during processing !!! 'NoneType' object has no attribute 'reshape'
Traceback (most recent call last):
File "D:\Programme\ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 345, 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 "D:\Programme\ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 220, 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 "D:\Programme\ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 192, in _map_node_over_list
process_inputs(input_dict, i)
File "D:\Programme\ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 181, in process_inputs
results.append(getattr(obj, func)(**inputs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Programme\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-ReActor\nodes.py", line 373, in execute
script.process(
File "D:\Programme\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-ReActor\scripts\reactor_faceswap.py", line 109, in process
result = swap_face(
^^^^^^^^^^
File "D:\Programme\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-ReActor\scripts\reactor_swapper.py", line 362, in swap_face
result = face_swapper.get(result, target_face, source_face)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Programme\ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\insightface\model_zoo\inswapper.py", line 50, in get
latent = source_face.normed_embedding.reshape((1,-1))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'reshape'
Prompt executed in 0.54 seconds
This the consol log. I also looked in the files and asked Chatgpt but i couldnt find the problem.
***Fixed the error below by replacing the motion_module.py file located under "Stable AI\stable-diffusion-webui\extensions\sd-webui-animatediff" with the file on this link here https://github.com/camenduru/webui-animatediff/blob/master/motion_module.py **
I have seen fixes for the "NoneType" error but this " AttributeError: 'NoneType' object has no attribute 'batch_size' " I cannot resolve. It will generate fine using txttoimg but as soon as I enable AnimatedDiff and choose generate I get the error. I have tried different motion models, other creator suggested settings with no avail. I have uninstalled and reinstalled and I know its gotta be something simple. Any suggestions would be appreciated. Rather new to Stable Diffusion, usually pretty resourcful but here I am.
**Additional information**
In the A1111 WebUi terminal I see the following when trying to execute .
"stable-diffusion-webui\extensions\sd-webui-animatediff\motion_module.py", line 334, in forward
video_length = mm_animatediff.ad_params.batch_size
AttributeError: 'NoneType' object has no attribute 'batch_size'
Looking at motion_module.py line 334 is "video_length = mm_animatediff.ad_params.batch_size"
I tried different number of frames as at a glance it appears to be a video length issue?
This is probably caused by lack of cat.jpg file, please import os and add
print(os.path.exists('cat.jpg'))
immediately before
img = cv2.imread('cat.jpg')
If it outputs False this mean cat.jpg is not there. You might use print(os.getcwd()) to check where cat.jpg should be placed xor provide full path to file to solve this issue.
You are getting this error on line 3 because you are taking the size of img, and img is (according to the interpreter), None.
So why is it None? You want to look at its definition.
img = cv2.imread('cat.jpg')
So what happens is that imread returns None. When does that happen? When the file doesn’t exist.
Therefore, the file cat.jpg is not in the working directory of your python program.
Therefore you will want to check if your program was launched in the right directory (or use os.chdir to change the directory).
I'm trying to use an upscaler and I keep getting this message any time my workflow get to the upscaling part(id odes the same if I try using control net):
Error occurred when executing UpscaleModelLoader: 'NoneType' object has no attribute 'lower' File "C:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 153, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 83, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 76, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AI\ComfyUI_windows_portable\ComfyUI\comfy_extras\nodes_upscale_model.py", line 20, in load_model sd = comfy.utils.load_torch_file(model_path, safe_load=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AI\ComfyUI_windows_portable\ComfyUI\comfy\utils.py", line 12, in load_torch_file if ckpt.lower().endswith(".safetensors"): ^^^^^^^^^^
*please help in on a time crunch