Skip to content

NotImplementedError: Cannot copy out of meta tensor in latest version #41

@sicp-dnegvp

Description

@sicp-dnegvp

Getting this in your latest version (main) in Linux:

got prompt
Loading SAM3D model...
Precision: bf16
All required checkpoints present
DINOv2 safetensors already present
MoGe safetensors already present
Model loaded successfully
DepthEstimate: Running depth estimation with MoGe...
Loading MoGe model from /opt/ComfyUI/models/sam3dobjects/moge_vitl.safetensors...
MoGe v1 loaded from moge_vitl.safetensors (421 tensors, meta-device fast load)
MoGe wrapped in ModelPatcher (dtype=torch.bfloat16)
Requested to load MoGeModelV1
loaded completely; 19349.30 MB usable, 596.56 MB loaded, full load: True
Depth estimation done: 5s
GenerateSLAT: Starting SLAT generation...
Pointmap shape: torch.Size([1062, 1600, 3])
Running Stage 1 (sparse structure)...
Running Stage 1 (sparse gen)
Preprocessing image...
2026-03-02 16:29:48.770 | WARNING  | /opt/ComfyUI/custom_nodes/ComfyUI-SAM3DObjects.nodes.sam3d.transforms:__post_init__:1359 - No rgb pointmap normalizer provided, using scale + shift 
2026-03-02T16:29:48.770102+0000 WARNING No rgb pointmap normalizer provided, using scale + shift 
Loading Stage 1 models...
[SPARSE] Backend: spconv
Shared DINOv2 backbone across 2 Dino instances (saved ~1.1GB)
Wrapped DINOv2 attention blocks (24 blocks)
Wrapped DINOv2 attention blocks (24 blocks)
Requested to load ShortCut
Requested to load SparseStructureDecoderTdfyWrapper
Requested to load EmbedderFuser
loaded completely; 18600.16 MB usable, 3661.95 MB loaded, full load: True
loaded completely; 14922.26 MB usable, 140.52 MB loaded, full load: True
loaded completely; 14776.13 MB usable, 1251.76 MB loaded, full load: True
Running sparse structure generation...
Stage 1 (sparse structure): 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 12/12 [00:04<00:00,  2.82it/s]
Decoding pose...
Stage 1 complete
Saved sparse structure: /opt/ComfyUI/output/sam3d_run_1/sparse_structure.pt
Stage 1 complete, saved to: /opt/ComfyUI/output/sam3d_run_1/sparse_structure.pt
Running Stage 2 (SLAT generation)...
Running Stage 2 (SLAT gen)
Preprocessing image for SLAT...
2026-03-02 16:29:56.130 | WARNING  | /opt/ComfyUI/custom_nodes/ComfyUI-SAM3DObjects.nodes.sam3d.transforms:__post_init__:1359 - No rgb pointmap normalizer provided, using scale + shift 
2026-03-02T16:29:56.130160+0000 WARNING No rgb pointmap normalizer provided, using scale + shift 
Loading Stage 2 models...
Auto-detected conv backend: flex_gemm
Shared DINOv2 backbone across 2 Dino instances (saved ~1.1GB)
Wrapped DINOv2 attention blocks (24 blocks)
Wrapped DINOv2 attention blocks (24 blocks)
Requested to load FlowMatching
Requested to load EmbedderFuser
!!! Exception during processing !!! Cannot copy out of meta tensor; no data! Please use torch.nn.Module.to_empty() instead of torch.nn.Module.to() when moving module from meta to a different device.
Traceback (most recent call last):
  File "/opt/ComfyUI/execution.py", line 524, 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 "/opt/ComfyUI/execution.py", line 333, 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 "/opt/ComfyUI/execution.py", line 307, in _async_map_node_over_list
    await process_inputs(input_dict, i)
  File "/opt/ComfyUI/execution.py", line 295, in process_inputs
    result = f(**inputs)
             ^^^^^^^^^^^
  File "/opt/ComfyUI/custom_nodes/ComfyUI-SAM3DObjects/nodes/generate_slat.py", line 249, in generate_slat
    stage2_result = run_stage2(
                    ^^^^^^^^^^^
  File "/opt/ComfyUI/custom_nodes/ComfyUI-SAM3DObjects/nodes/utils/stages.py", line 1128, in run_stage2
    comfy.model_management.load_models_gpu([slat_gen_patcher, slat_emb_patcher])
  File "/opt/ComfyUI/comfy/model_management.py", line 751, in load_models_gpu
    loaded_model.model_load(lowvram_model_memory, force_patch_weights=force_patch_weights)
  File "/opt/ComfyUI/comfy/model_management.py", line 533, in model_load
    self.model_use_more_vram(use_more_vram, force_patch_weights=force_patch_weights)
  File "/opt/ComfyUI/comfy/model_management.py", line 563, in model_use_more_vram
    return self.model.partially_load(self.device, extra_memory, force_patch_weights=force_patch_weights)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ComfyUI/comfy/model_patcher.py", line 1022, in partially_load
    self.detach()
  File "/opt/ComfyUI/comfy/model_patcher.py", line 1034, in detach
    self.unpatch_model(self.offload_device, unpatch_weights=unpatch_all)
  File "/opt/ComfyUI/comfy/model_patcher.py", line 899, in unpatch_model
    self.model.to(device_to)
  File "/usr/local/lib/python3.12/dist-packages/torch/nn/modules/module.py", line 1381, in to
    return self._apply(convert)
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/torch/nn/modules/module.py", line 933, in _apply
    module._apply(fn)
  File "/usr/local/lib/python3.12/dist-packages/torch/nn/modules/module.py", line 933, in _apply
    module._apply(fn)
  File "/usr/local/lib/python3.12/dist-packages/torch/nn/modules/module.py", line 933, in _apply
    module._apply(fn)
  [Previous line repeated 2 more times]
  File "/usr/local/lib/python3.12/dist-packages/torch/nn/modules/module.py", line 964, in _apply
    param_applied = fn(param)
                    ^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/torch/nn/modules/module.py", line 1374, in convert
    raise NotImplementedError(
NotImplementedError: Cannot copy out of meta tensor; no data! Please use torch.nn.Module.to_empty() instead of torch.nn.Module.to() when moving module from meta to a different device.

Total VRAM 24355 MB, total RAM 128652 MB
pytorch version: 2.10.0+cu128
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA A40-24Q : native
working around nvidia conv3d memory bug.
Using Flash Attention
Python version: 3.12.3 (main, Feb 4 2025, 14:48:35) [GCC 13.3.0]
ComfyUI version: 0.15.1
ComfyUI frontend version: 1.39.19

Re-downloaded all models fresh from your HF https://huggingface.co/apozz/sam-3d-objects-safetensors/tree/main

This is the "full_generation" template workflow with the elephant image.

Any ideas what might cause this? It was working fine last week.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions