Open andytriboletti opened 2 months ago
when I add --device cpu it generates the texture file.
when I try --device cuda it fails
Using this command works: python run.py featured_image.png --output-dir output/ --device cuda:0 --model-save-format glb
I used --device cuda:0 instead of --device cuda.
But not when using .obj, only cpu works there.
Replace positions_to_colors
in bake_texture.py
line 137 with the following code:
def positions_to_colors(model, scene_code, positions_texture, texture_resolution):
positions = torch.tensor(
positions_texture.reshape(-1, 4)[:, :-1], device=scene_code.device
)
with torch.no_grad():
queried_grid = model.renderer.query_triplane(
model.decoder,
positions,
scene_code,
)
rgb_f = queried_grid["color"].cpu().numpy().reshape(-1, 3)
rgba_f = np.insert(rgb_f, 3, positions_texture.reshape(-1, 4)[:, -1], axis=1)
rgba_f[rgba_f[:, -1] == 0.0] = [0, 0, 0, 0]
return rgba_f.reshape(texture_resolution, texture_resolution, 4)
--bake-texture option doesn't work with gpu. without that option it works. here is the error message: