DynamicVRAM on Windows: 'NoneType' object has no attribute 'is_floating_point' when loading CLIP Vision model
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 158
Description
### Custom Node Testing
- [x] I have tried disabling custom nodes and the issue persists (see [how to disable custom nodes](https://docs.comfy.org/troubleshooting/custom-node-issues#step-1%3A-test-with-all-custom-nodes-disabled) if you need help)
### Expected Behavior
Bug Description
On Windows with DynamicVRAM enabled, loading a CLIP Vision model (e.g. via WanVideoWrapper's WanVideoClipVisionEncode) crashes with AttributeError: 'NoneType' object has no attribute
'is_floating_point'.
Root Cause
In comfy/ops.py, disable_weight_init.Linear.__init__ takes the Windows DynamicVRAM lazy init path (line ~302) which sets:
self.weight_comfy_model_dtype = dtype
When a Linear layer is created without an explicit dtype parameter (defaulting to None), this attribute becomes None.
In comfy/model_patcher.py (line ~1529), the getattr finds the attribute but it's None, so it doesn't fall back to weight.dtype:
model_dtype = getattr(m, param_key + "_comfy_model_dtype", weight.dtype)
# Returns None because the attribute exists but is None
This creates TensorGeometry(dtype=None) which crashes at element_size().
Affected Code
comfy/clip_model.py line 315 — CLIPVisionModelProjection creates visual_projection without dtype/device:
self.visual_projection = operations.Linear(config_dict["hidden_size"], config_dict["projection_dim"], bias=False)
Suggested Fix
1. Defensive fix in comfy/model_patcher.py (lines ~1529 and ~1556):
# Before:
model_dtype = getattr(m, param_key + "_comfy_model_dtype", weight.dtype)
# After:
model_dtype = getattr(m, param_key + "_comfy_model_dtype", None) or weight.dtype
2. Upstream fix in comfy/clip_model.py line 315:
self.visual_projection = operations.Linear(config_dict["hidden_size"], config_dict["projection_dim"], bias=False, dtype=dtype, device=device)
Environment
- ComfyUI: v0.12.3
- OS: Windows 11
- GPU: NVIDIA RTX PRO 6000 Blackwell (96GB VRAM)
- PyTorch: 2.9.1+cu130
- DynamicVRAM: Enabled
Stack Trace
File "comfy/model_patcher.py", line 1532, in setup_param
return comfy.memory_management.vram_aligned_size(geometry)
File "comfy/memory_management.py", line 43, in vram_aligned_size
size = tensor.numel() * tensor.element_size()
File "comfy/memory_management.py", line 12, in element_size
info = torch.finfo(self.dtype) if self.dtype.is_floating_point else torch.iinfo(self.dtype)
AttributeError: 'NoneType' object has no attribute 'is_floating_point'
---
### Actual Behavior
Bug Description
On Windows with DynamicVRAM enabled, loading a CLIP Vision model (e.g. via WanVideoWrapper's WanVideoClipVisionEncode) crashes with AttributeError: 'NoneType' object has no attribute
'is_floating_point'.
Root Cause
In comfy/ops.py, disable_weight_init.Linear.__init__ takes the Windows DynamicVRAM lazy init path (line ~302) which sets:
self.weight_comfy_model_dtype = dtype
When a Linear layer is created without an explicit dtype parameter (defaulting to None), this attribute becomes None.
In comfy/model_patcher.py (line ~1529), the getattr finds the attribute but it's None, so it doesn't fall back to weight.dtype:
model_dtype = getattr(m, param_key + "_comfy_model_dtype", weight.dtype)
# Returns None because the attribute exists but is None
This creates TensorGeometry(dtype=None) which crashes at element_size().
Affected Code
comfy/clip_model.py line 315 — CLIPVisionModelProjection creates visual_projection without dtype/device:
self.visual_projection = operations.Linear(config_dict["hidden_size"], config_dict["projection_dim"], bias=False)
Suggested Fix
1. Defensive fix in comfy/model_patcher.py (lines ~1529 and ~1556):
# Before:
model_dtype = getattr(m, param_key + "_comfy_model_dtype", weight.dtype)
# After:
model_dtype = getattr(m, param_key + "_comfy_model_dtype", None) or weight.dtype
2. Upstream fix in comfy/clip_model.py line 315:
self.visual_projection = operations.Linear(config_dict["hidden_size"], config_dict["projection_dim"], bias=False, dtype=dtype, device=device)
Environment
- ComfyUI: v0.12.3
- OS: Windows 11
- GPU: NVIDIA RTX PRO 6000 Blackwell (96GB VRAM)
- PyTorch: 2.9.1+cu130
- DynamicVRAM: Enabled
Stack Trace
File "comfy/model_patcher.py", line 1532, in setup_param
return comfy.memory_management.vram_aligned_size(geometry)
File "comfy/memory_management.py", line 43, in vram_aligned_size
size = tensor.numel() * tensor.element_size()
File "comfy/memory_management.py", line 12, in element_size
info = torch.finfo(self.dtype) if self.dtype.is_floating_point else torch.iinfo(self.dtype)
AttributeError: 'NoneType' object has no attribute 'is_floating_point'
---
### Steps to Reproduce
### Debug Logs
```powershell
❯ WanVideoClipVisionEncode
'NoneType' object has no attribute 'is_floating_point'
# ComfyUI Error Report
## Error Details
- **Node ID:** 1813
- **Node Type:** WanVideoClipVisionEncode
- **Exception Type:** AttributeError
- **Exception Message:** 'NoneType' object has no attribute 'is_floating_point'
## Stack Trace
File "C:\ai_program_files\pinokio\api\comfyNewPinokio.git\app\execution.py", line 530, in execute
output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb,
pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ai_program_files\pinokio\api\comfyNewPinokio.git\app\execution.py", line 334, in get_output_data
return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb,
pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ai_program_files\pinokio\api\comfyNewPinokio.git\app\custom_nodes\comfyui-lora-manager\py\metadata_collector\metadata_hook.py", line 168, in async_map_node_over_list_with_metadata
results = await original_map_node_over_list(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ai_program_files\pinokio\api\comfyNewPinokio.git\app\execution.py", line 308, in _async_map_node_over_list
await process_inputs(input_dict, i)
File "C:\ai_program_files\pinokio\api\comfyNewPinokio.git\app\execution.py", line 296, in process_inputs
result = f(**inputs)
^^^^^^^^^^^
File "C:\ai_program_files\pinokio\api\comfyNewPinokio.git\app\custom_nodes\ComfyUI-WanVideoWrapper\nodes.py", line 656, in process
clip_embeds = clip_vision.encode_image(image).penultimate_hidden_states.to(device)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ai_program_files\pinokio\api\comfyNewPinokio.git\app\comfy\clip_vision.py", line 59, in encode_image
comfy.model_management.load_model_gpu(self.patcher)
File "C:\ai_program_files\pinokio\api\comfyNewPinokio.git\app\comfy\model_management.py", line 751, in load_model_gpu
return load_models_gpu([model])
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ai_program_files\pinokio\api\comfyNewPinokio.git\app\comfy\model_management.py", line 746, in load_models_gpu
loaded_model.model_load(lowvram_model_memory, force_patch_weights=force_patch_weights)
File "C:\ai_program_files\pinokio\api\comfyNewPinokio.git\app\comfy\model_management.py", line 528, in model_load
self.model_use_more_vram(use_more_vram, force_patch_weights=force_patch_weights)
File "C:\ai_program_files\pinokio\api\comfyNewPinokio.git\app\comfy\model_management.py", line 558, in model_use_more_vram
return self.model.partially_load(self.device, extra_memory, force_patch_weights=force_patch_weights)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ai_program_files\pinokio\api\comfyNewPinokio.git\app\comfy\model_patcher.py", line 1619, in partially_load
raise e
File "C:\ai_program_files\pinokio\api\comfyNewPinokio.git\app\comfy\model_patcher.py", line 1616, in partially_load
self.load(device_to, dirty=dirty)
File "C:\ai_program_files\pinokio\api\comfyNewPinokio.git\app\comfy\model_patcher.py", line 1541, in load
v_weight_size += setup_param(self, m, n, "weight")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ai_program_files\pinokio\api\comfyNewPinokio.git\app\comfy\model_patcher.py", line 1532, in setup_param
return comfy.memory_management.vram_aligned_size(geometry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ai_program_files\pinokio\api\comfyNewPinokio.git\app\comfy\memory_management.py", line 43, in vram_aligned_size
size = tensor.numel() * tensor.element_size()
^^^^^^^^^^^^^^^^^^^^^
File "C:\ai_program_files\pinokio\api\comfyNewPinokio.git\app\comfy\memory_management.py", line 12, in element_size
info = torch.finfo(self.dtype) if self.dtype.is_floating_point else torch.iinfo(self.dtype)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
### Other
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.