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.

Discussions

python - AttributeError: 'Series' object has no attribute 'reshape' - Stack Overflow
I'm using sci-kit learn linear regression algorithm. While scaling Y target feature with: Ys = scaler.fit_transform(Y) I got ValueError: Expected 2D array, got 1D array instead: After that I re... More on stackoverflow.com
🌐 stackoverflow.com
python 3.x - AttributeError: 'list' object has no attribute 'reshape' when using reshape for a list - Stack Overflow
Communities for your favorite technologies. Explore all Collectives · Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work More on stackoverflow.com
🌐 stackoverflow.com
python - Seaborn Heatmap Error: " AttributeError: 'NoneType' object has no attribute 'reshape' " - Stack Overflow
I am doing an NLP project looking at the cosine similarities between the respective works of 10 different classic rock artists. I have done similarity queries and created a dataframe called similar... More on stackoverflow.com
🌐 stackoverflow.com
AttributeError: 'NoneType' object has no attribute 'shape'
Hi have you ever found a fix for this? I'm experiencing the same issue. More on reddit.com
🌐 r/StableDiffusion
5
8
October 18, 2023
🌐
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 · runfile('D:/pythoncode/CV/deepfakes/Deep-Live-Cam/new_model/run.py', wdir='D:/pythoncode/CV/deepfakes/Deep-Live-Cam/new_model') Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}} find model: C:\Users\bingo/.insightface\models\buffalo_l\2d106det.onnx landmark_2d_106 ['None', 3, 192, 192] 0.0 1.0 Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}} find model: C:\Users\bingo/.insi
Author   mrbingo1024
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › programming › python
AttributeError: 'NoneType' object has no attribute 'shape' - Raspberry Pi Forums
(venv) cheeyong@raspberrypi:~ $ ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/cheeyong/venv/lib/python3.11/site-packages/imutils/convenience.py", line 69, in resize (h, w) = image.shape[:2] ^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'shape' (venv) cheeyong@raspberrypi:~ ...
🌐
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, ...
Find elsewhere
🌐
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.

🌐
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…
🌐
Coder Legion
coderlegion.com › 367 › resolved-attributeerror-dataframe-object-has-no-attribute-reshape
Resolved: Attributeerror: 'dataframe' object has no attribute 'reshape' - Coder Legion
Encountering the `AttributeError 'DataFrame' object has no attribute 'reshape'` is common when using Pandas in Python. It happens due to the absence of the reshape attribute within the DataFrame class, especially during reshaping operations. ...
🌐
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...
🌐
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
🌐
OpenCV Q&A Forum
answers.opencv.org › question › 209433 › attributeerror-nonetype-object-has-no-attribute-shape
AttributeError: 'NoneType' object has no attribute 'shape' - OpenCV Q&A Forum
Hi all! I need your help regarding the following code. My goal is to read and show the video with a resolution modification. import cv2 cap = cv2.VideoCapture("C:/Users/user/Desktop/Foot_Detection/ball_tracking_example.mp4") def rescale_frame(frame, percent=30): width = int(frame.shape[1] * percent/ 100) height = int(frame.shape[0] * percent/ 100) dim = (width, height) return cv2.resize(frame, dim, interpolation =cv2.INTER_AREA) if (cap.isOpened() == False): print("Error opening video stream or file") while (cap.isOpened()): # Capture frame-by-frame ret, frame = cap.read() frame = rescale_frame(frame, percent=30) if ret == True: cv2.imshow('Frame', frame) if cv2.waitKey(25) & 0xFF == ord('q'): break else: break cap.release() cv2.destroyAllWindows() After executing the above code, the video displayed on my screen till the end.
🌐
Fast.ai
forums.fast.ai › part 1 (2018)
AttributeError: 'NoneType' object has no attribute 'shape' - Part 1 (2018) - fast.ai Course Forums
December 22, 2017 - My data is organised as: train:- containing folder for each class valid :- containing folder for each class test:- contains all test images [error]
🌐
OpenCV
forum.opencv.org › t › attributeerror-nonetype-object-has-no-attribute-shape › 4910
AttributeError: 'NoneType' object has no attribute 'shape' - imgcodecs - OpenCV
August 24, 2021 - What is this error?? Traceback (most recent call last): File "code.py", line 1717, in shape height, width = input.shape AttributeError: 'NoneType' object has no attribute 'shape' This is the code: input…
🌐
Stack Overflow
stackoverflow.com › questions › 72159124 › attributeerror-float-object-has-no-attribute-reshape
python - "AttributeError: 'float' object has no attribute 'reshape'." - Stack Overflow
1 Reshaping Error in python · 1 NumPy: TypeError: reshape() got an unexpected keyword argument 'order' 2 AttributeError: 'NoneType' object has no attribute 'reshape' 0 reshape image error · 0 Numpy reshape seems to output value error ·
🌐
Bobby Hadz
bobbyhadz.com › blog › python-attributeerror-nonetype-object-has-no-attribute-shape
AttributeError: 'NoneType' object has no attribute 'shape' | bobbyhadz
April 8, 2024 - The Python "AttributeError: 'NoneType' object has no attribute 'shape'" occurs when we access the shape attribute on a None value, e.g.
🌐
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 ...