iffyloop / TripoSR-Bake

Generate 3D meshes from a single 2D image using TripoSR, complete with manual geometry editing and texture baking support
The Unlicense
48 stars 0 forks source link

Bug: crash in device=cuda mode #2

Closed Nomad1 closed 4 months ago

Nomad1 commented 4 months ago

There is a minor bug when non-CPU device is used for torch:

(3/3): Marching cubes
Traceback (most recent call last):
  File "/home/gorbuz/content/TripoSR-Bake/01-mesh.py", line 202, in <module>
    main()
  File "/home/gorbuz/content/TripoSR-Bake/01-mesh.py", line 192, in main
    mesh_result = run_mesh(args, tsr_result, grid_result)
  File "/home/gorbuz/content/TripoSR-Bake/01-mesh.py", line 91, in run_mesh
    .numpy()
TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

It's easily fixed by adding .cpu() to line 91 of 01-mesh.py. It's simple enough to fix so I won't submit a PR for it.

iffyloop commented 4 months ago

Perfect, thanks for reporting! Should be fixed now.