The message
AttributeError: module 'torch' has no attribute 'float8_e4m3fn'
Affects: AUTOMATIC1111 Stable Diffusion WebUI, ComfyUI, Python
Why is this happening?
The data type torch.float8_e4m3fn has only been available since PyTorch 2.1. If an older version is installed, any access to it will fail with this message. In AUTOMATIC1111, this happens when the “FP8 weight” option is enabled but PyTorch 2.0 is still in the venv: updating the WebUI with git pull does not automatically replace an already installed PyTorch. Special builds (e.g. for Jetson) with a pre-release version of 2.1 are also affected.
How to fix it
- Check your PyTorch version. AUTOMATIC1111: in the
stable-diffusion-webuifolder, runvenv\Scripts\python.exe -c "import torch; print(torch.__version__)". ComfyUI portable: in theComfyUI_windows_portablefolder, run.\python_embeded\python.exe -c "import torch; print(torch.__version__)". Anything below 2.1 is too old. - AUTOMATIC1111, quick fix: Under Settings > Optimizations, set the “FP8 weight” option to “Disable”.
- AUTOMATIC1111, proper solution: In
webui-user.bat, add--reinstall-torchonce toset COMMANDLINE_ARGS=and start it. The WebUI will then install the PyTorch version that matches its state (from version 1.8.0 onward, that is 2.1.2). After that, remove the option again. - ComfyUI portable: The easiest way is to download the current portable version again. Or update PyTorch with
.\python_embeded\python.exe -m pip install --upgrade torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu130(for RTX 20 and newer; keep the driver up to date). - ComfyUI installed manually: Activate the venv and run
pip install --upgrade torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu130. - If a newer PyTorch is not possible (e.g. on special hardware), use models in fp16 or GGUF instead of fp8.
Set up from scratch again
If it still doesn’t work after that, a fresh setup step by step often helps:
- Set up and maintain ComfyUI on Windows
Desktop or Portable, where the models belong, sharing models with other programs, safely installing custom nodes, updates, startup options … - Your First Image with ComfyUI
Install Comfy Desktop, learn the interface, and create your first AI image with FLUX.2 [small] 4B or Z-Image Turbo. - Your First AI Video with LTX in ComfyUI
Use LTX-2.3 in ComfyUI to create short videos with sound from text or an image. Template, files, settings, and license.
Terms for this
Similar errors
- A module that was compiled using NumPy 1.x cannot be run in NumPy 2.x – a package does not match the installed NumPy version
- No matching distribution found for torch (wrong Python version)
- ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied – pip cannot modify a file
- ImportError: DLL load failed while importing …: The specified module could not be found – a Python package is missing a Windows DLL
- pip: Microsoft Visual C++ 14.0 or greater is required
Sources
- https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/master/modules/shared_options.py
- https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/master/modules/launch_utils.py
- https://forums.developer.nvidia.com/t/comfyui-error-float8-e4m3fn-with-pytorch/304812
- https://github.com/Comfy-Org/ComfyUI/blob/master/README.md
Checked on Oct 27, 2026. Didn't help? Ask in the forum and name the graphics card, program, and the full message.