NVlabs / nvdiffrec

Official code for the CVPR 2022 (oral) paper "Extracting Triangular 3D Models, Materials, and Lighting From Images".
Other
2.09k stars 222 forks source link

fail to run nerf-synthetic data #103

Open SarahWeiii opened 1 year ago

SarahWeiii commented 1 year ago

Hi when I tried to run the nerf-synthetic dataset with configs/nerf_ficus.json, it shows the following failure info after finishing the first stage optimization:

Writing material:  out/nerf_lego/dmtet_mesh/mesh.mtl
Done exporting mesh
Traceback (most recent call last):
  File "train.py", line 622, in <module>
    optimize_geometry=not FLAGS.lock_pos)
  File "train.py", line 415, in optimize_mesh
    img_loss, reg_loss = trainer(target, it)
  File "/home/sarahwei/anaconda3/envs/dmodel/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "train.py", line 299, in forward
    return self.geometry.tick(glctx, target, self.light, self.material, self.image_loss_fn, it)
  File "/home/sarahwei/code/nvdiffrec/geometry/dlmesh.py", line 56, in tick
    buffers = self.render(glctx, target, lgt, opt_material)
  File "/home/sarahwei/code/nvdiffrec/geometry/dlmesh.py", line 49, in render
    num_layers=self.FLAGS.layers, msaa=True, background=target['background'], bsdf=bsdf)
  File "/home/sarahwei/code/nvdiffrec/render/render.py", line 230, in render_mesh
    rast, db = peeler.rasterize_next_layer()
  File "/home/sarahwei/anaconda3/envs/dmodel/lib/python3.6/site-packages/nvdiffrast/torch/ops.py", line 378, in rasterize_next_layer
    result = _rasterize_func.apply(self.raster_ctx, self.pos, self.tri, self.resolution, self.ranges, self.grad_db, self.peeling_idx)
  File "/home/sarahwei/anaconda3/envs/dmodel/lib/python3.6/site-packages/nvdiffrast/torch/ops.py", line 246, in forward
    out, out_db = _get_plugin(gl=True).rasterize_fwd_gl(raster_ctx.cpp_wrapper, pos, tri, resolution, ranges, peeling_idx)
RuntimeError: Cuda error: 700[cudaMemcpy3DAsync(&p, stream);]
Aborted (core dumped)
jmunkberg commented 1 year ago

Hello @SarahWeiii ,

In the second pass, we optimize 2D textures, and the default in configs/nerf_ficus.json is set to high resolution textures "texture_res": [ 2048, 2048 ], as we are running most tests on GPUS with 32+GB memory.

You can try reducing this size in case you are running this on a GPU with less available memory.