| 119 | ThreadPoolExecutor(max_workers=32) as saver_executor: |
| 120 | |
| 121 | def loader(sha256): |
| 122 | try: |
| 123 | coords, attr = o_voxel.io.read_vxz( |
| 124 | os.path.join(opt.dual_grid_root, f'dual_grid_{opt.resolution}', f'{sha256}.vxz'), |
| 125 | num_threads=4 |
| 126 | ) |
| 127 | vertices = sp.SparseTensor( |
| 128 | (attr['vertices'] / 255.0).float(), |
| 129 | torch.cat([torch.zeros_like(coords[:, 0:1]), coords], dim=-1), |
| 130 | ) |
| 131 | intersected = vertices.replace(torch.cat([ |
| 132 | attr['intersected'] % 2, |
| 133 | attr['intersected'] // 2 % 2, |
| 134 | attr['intersected'] // 4 % 2, |
| 135 | ], dim=-1).bool()) |
| 136 | load_queue.put((sha256, vertices, intersected)) |
| 137 | except Exception as e: |
| 138 | print(f"[Loader Error] {sha256}: {e}") |
| 139 | load_queue.put((sha256, None, None)) |
| 140 | |
| 141 | loader_executor.map(loader, sha256s) |
| 142 | |