It is possible to return a value of type None, check the type of X_train in the following lines:

CopyX_train = X_train.resize((32, 32))
type(X_train)    
X_train = X_train.reshape((len(X_train), 3, 32, 32))
type(X_train)
Answer from Leonid Dubrovin on Stack Overflow
🌐
Reddit
reddit.com › r/comfyui › 'nonetype' object has no attribute 'reshape' error when using reactor node
r/comfyui on Reddit: 'NoneType' object has no attribute 'reshape' error when using ReActor node
April 14, 2025 -

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.

🌐
GitHub
github.com › Gourieff › ComfyUI-ReActor › issues › 104
[SOLVED] 'NoneType' object has no attribute 'reshape' · Issue #104 · Gourieff/ComfyUI-ReActor
April 14, 2025 - \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\C
Author   User36737288
🌐
GitHub
github.com › hacksider › Deep-Live-Cam › issues › 577
AttributeError: 'NoneType' object has no attribute 'reshape' · Issue #577 · hacksider/Deep-Live-Cam
September 13, 2024 - AttributeError: 'NoneType' object has no attribute 'reshape'#577 · Copy link · mrbingo1024 · opened · on Sep 13, 2024 · Issue body actions ·
Author   mrbingo1024
🌐
Reddit
reddit.com › r/stablediffusion › attributeerror: 'nonetype' object has no attribute 'shape'
r/StableDiffusion on Reddit: AttributeError: 'NoneType' object has no attribute 'shape'
October 18, 2023 -

I used the ControlNet extension & the Realistic Vision checkpoint, and it keeps giving me this error, "AttributeError: 'NoneType' object has no attribute 'shape'" whenever I try to generate a image. Even not using them, I still get this error.

What is the issue and how can I fix it?

Edit: it turns out when trying to use ControlNet, I was matching one of the preprocessors with the wrong models.

Find elsewhere
🌐
GitHub
github.com › facebookresearch › pytorch3d › issues › 301
tutorial: render textured meshes - AttributeError: 'NoneType' object has no attribute 'reshape' · Issue #301 · facebookresearch/pytorch3d
August 5, 2020 - 🐛 Bugs / Unexpected behaviors Hi, I am trying to run the render textured meshes in a python script and I got the following error: AttributeError: 'NoneType' object has no attribute 'reshape' Instructions To Reproduce the Issue: I current...
Author   vpolflie
🌐
GitHub
github.com › microsoft › EconML › issues › 431
AttributeError: 'NoneType' object has no attribute 'reshape' when loading own Graph · Issue #431 · py-why/EconML
March 12, 2021 - AttributeError: 'NoneType' object has no attribute 'reshape' when loading own Graph#431 · Copy link · JoHorni · opened · on Mar 12, 2021 · Issue body actions · Hey, I'm working with observational Data about Horse Competitions and want to know how the gender of a horse effects their success in a show.
Author   JoHorni
🌐
GitHub
github.com › facebookresearch › pytorch3d › issues › 293
'NoneType' object has no attribute 'reshape' (Internal error when loading texture map and rendering) · Issue #293 · facebookresearch/pytorch3d
July 30, 2020 - 105 """ --> 106 vertex_textures = meshes.textures.verts_rgb_padded().reshape(-1, 3) # (V, C) 107 vertex_textures = vertex_textures[meshes.verts_padded_to_packed_idx(), :] 108 faces_packed = meshes.faces_packed() AttributeError: 'NoneType' object has no attribute 'reshape'
Author   dvirginz
🌐
Python Forum
python-forum.io › thread-13879.html
'list' object has no attribute 'reshape'
November 4, 2018 - Hi All, I've just joined this forum, also new to Python, with background in other languages. I've been trying a small piece of code below using jupyter ipython in notebooks.azure.com, the error is coming from the last call for np.reshape function w...
🌐
Hugging Face
discuss.huggingface.co › 🤗datasets
Seeing AttributeError: 'Dataset' object has no attribute 'reshape' when using "dataset.get_nearest_examples" - 🤗Datasets - Hugging Face Forums
June 25, 2023 - Hello, I am trying to use Faiss indexing for an image similarity application. However, I am seeing an Attribute Error. Here’s the code that I am trying # Loading dataset dataset = load_dataset("imagefolder", data_dir="/data") # Pre processing images def transforms(examples): examples["image"] = [image.resize((384, 384)).convert("RGB") for image in examples["image"]] return examples # Applying the transform function to dataset dataset = dataset.map(transforms, batched=True, batch_size=...
🌐
Hugging Face
discuss.huggingface.co › beginners
Error: AttributeError: 'NoneType' object has no attribute 'shape' when prompt tuning with Chatglm2 - Beginners - Hugging Face Forums
October 9, 2023 - I modified simple code of peft to train chatglm2-6b witn prompt-tuning. Below is my code: from transformers import AutoModelForCausalLM from peft import get_peft_config, get_peft_model, PromptTuningInit, PromptTuningConfig, TaskType, PeftType import torch from datasets import load_dataset import ...
🌐
Quora
quora.com › How-do-you-resolve-the-read-file-error-nonetype-object-has-no-attribute-shape-python-file-development
How to resolve the read file error ''nonetype' object has no attribute 'shape'' (python, file, development) - Quora
Answer: In general, that error means that you have a variable that refers to None where you expect it to refer to an object that has an attribute “shape”. Look at the code that created that object; for instance, judging from your question, ...
🌐
PyTorch Forums
discuss.pytorch.org › t › nonetype-object-has-no-attribute-shape › 140895
NoneType' object has no attribute 'shape' - PyTorch Forums
January 5, 2022 - so this is my code sentence = tokenize(sentence) X = bag_of_words(sentence,all_words) X = X.reshape(1,X.shape[0]) X = torch.from_numpy(X).to(device) and this is the error given AttributeError: ‘NoneType’ object has no…
🌐
Google Groups
groups.google.com › g › kivy-users › c › Fzyep9PwDEs
AttributeError: 'NoneType' object has no attribute 'shape'
February 12, 2023 - when i use Camera in my Widget , i stuck on thus erroe '' AttributeError: 'NoneType' object has no attribute 'shape''
🌐
GitHub
github.com › Gourieff › comfyui-reactor-node › issues › 409
'NoneType' object has no attribute 'reshape' #409
August 29, 2024 - Fast and Simple Face Swap Extension Node for ComfyUI - Gourieff/comfyui-reactor-node