Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: arg(): could not convert default argument 'workspace: tv::Tensor' into a Python object #731

Open
ifilipis opened this issue Dec 9, 2024 · 4 comments · Fixed by MrForExample/ComfyUI-3D-Pack#399

Comments

@ifilipis
Copy link

ifilipis commented Dec 9, 2024

Issue from the current commit when built from source with DISABLE_JIT=1 f0ffe61

!!! Exception during processing !!! arg(): could not convert default argument 'workspace: tv::Tensor' in method '<class 'spconv.core_cc.csrc.sparse.convops.gemmops.GemmTunerSimple'>.run_with_tuned_result' into a Python object (type not registered yet?)
Traceback (most recent call last):
  File "E:\ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 323, 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 "E:\ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 198, 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 "E:\ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)
  File "E:\ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_TRELLIS\custom_nodes.py", line 34, in load
    self.model = TrellisImageTo3DPipeline.from_pretrained(model_name)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_TRELLIS\extensions\trellis\pipelines\trellis_image_to_3d.py", line 55, in from_pretrained
    pipeline = super(TrellisImageTo3DPipeline, TrellisImageTo3DPipeline).from_pretrained(path)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_TRELLIS\extensions\trellis\pipelines\base.py", line 40, in from_pretrained
    k: models.from_pretrained(f"{path}/{v}")
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_TRELLIS\extensions\trellis\models\__init__.py", line 59, in from_pretrained
    model = __getattr__(config['name'])(**config['args'], **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_TRELLIS\extensions\trellis\models\structured_latent_vae\decoder_mesh.py", line 108, in __init__
    SparseSubdivideBlock3d(
  File "E:\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_TRELLIS\extensions\trellis\models\structured_latent_vae\decoder_mesh.py", line 43, in __init__
    sp.SparseConv3d(channels, self.out_channels, 3, indice_key=f"res_{self.out_resolution}"),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_TRELLIS\extensions\trellis\modules\sparse\conv\conv_spconv.py", line 11, in __init__
    import spconv.pytorch as spconv
  File "E:\ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\spconv\pytorch\__init__.py", line 7, in <module>
    from spconv.pytorch.core import SparseConvTensor
  File "E:\ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\spconv\pytorch\core.py", line 21, in <module>
    from spconv.tools import CUDAKernelTimer
  File "E:\ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\spconv\tools.py", line 16, in <module>
    from spconv.cppconstants import CPU_ONLY_BUILD
  File "E:\ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\spconv\cppconstants.py", line 15, in <module>
    import spconv.core_cc as _ext
ImportError: arg(): could not convert default argument 'workspace: tv::Tensor' in method '<class 'spconv.core_cc.csrc.sparse.convops.gemmops.GemmTunerSimple'>.run_with_tuned_result' into a Python object (type not registered yet?)
@MrForExample
Copy link

MrForExample commented Dec 11, 2024

Same here, any solution?
Installed from PyPI through pip install spconv-cu124 for python 3.12 on windows 11

@MrForExample
Copy link

After I comment out the line 15 in spconv\cppconstants.py it simply throws same error for the next line:

from spconv.core_cc.csrc.sparse.all import SpconvOps
ImportError: arg(): could not convert default argument 'workspace: tv::Tensor' in method '<class 'spconv.core_cc.csrc.sparse.convops.gemmops.GemmTunerSimple'>.run_with_tuned_result' into a Python object (type not registered yet?)

MrForExample added a commit to MrForExample/ComfyUI-3D-Pack that referenced this issue Dec 11, 2024
@if-ai
Copy link

if-ai commented Dec 14, 2024

that is weird I did have trouble with that part of the installation but it was because I tried installing it for cu120 first all I did was make sure to run the

(gen) PS D:\ComfyUI\custom_nodes\ComfyUI-IF_Trellis> micromamba activate gen

set your vars

cmd.exe /c "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64 "&&" powershell

I pip unistall spconv-cu120

pip install spconv-cu124

Also on powershell as admin make sure to set Set-ExecutionPolicy Unrestricted

If possible use Wezterm for win
https://wezfurlong.org/wezterm/install/windows.html

winget install wez.wezterm

I am in python

(gen) PS D:\ComfyUI> python --version
Python 3.12.5
(gen) PS D:\ComfyUI>

I made a full guide for setting up from the start

https://ko-fi.com/post/Installing-Triton-and-Sage-Attention-Flash-Attenti-P5P8175434

@MrForExample
Copy link

Can confirm this error is resolved in spconv 2.3.8, pip install spconv-cu124 now works as expected for python 3.12 on windows 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants