Skip to content

Commit

Permalink
Windows Support (torch-points3d#320)
Browse files Browse the repository at this point in the history
* Fix filepath parsing on Windows

* Windows support

On Windows, lambas cannot be pickled and therefore dispatched to worker pools with multiprocessing.
  • Loading branch information
Uakh authored Jul 2, 2020
1 parent 88997c4 commit 0a07f53
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Segmentation: KPConv on scannetV2
- Object Detection: VoteNet on scannetV2
- Add VoteNet Paper / Backbones within API
- Windows support

### Changed

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,11 @@ export TORCH_CUDA_ARCH_LIST="7.0;7.5"
```
See [this useful chart](http://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/) for more architecture compatibility.
#### Cannot use wandb on Windows
Raises `OSError: [WinError 6] The handle is invalid` / `wandb: ERROR W&B process failed to launch`
Wandb is currently broken on Windows (see [this issue](https://github.com/wandb/client/issues/862)), a workaround is to use the command line argument `wandb.log=false`
## Contributing
Contributions are welcome! The only asks are that you stick to the styling and that you add tests as you add more features!
Expand Down
10 changes: 4 additions & 6 deletions torch_points3d/datasets/base_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,16 @@ def set_filter(self, dataset_opt):
def _get_collate_function(conv_type, is_multiscale):
if is_multiscale:
if conv_type.lower() == ConvolutionFormat.PARTIAL_DENSE.value.lower():
return lambda datalist: MultiScaleBatch.from_data_list(datalist)
return MultiScaleBatch.from_data_list
else:
raise NotImplementedError(
"MultiscaleTransform is activated and supported only for partial_dense format"
)

is_dense = ConvolutionFormatFactory.check_is_dense_format(conv_type)
if is_dense:
return lambda datalist: SimpleBatch.from_data_list(datalist)
return SimpleBatch.from_data_list
else:
return lambda datalist: torch_geometric.data.batch.Batch.from_data_list(datalist)

return torch_geometric.data.batch.Batch.from_data_list
@staticmethod
def get_num_samples(batch, conv_type):
is_dense = ConvolutionFormatFactory.check_is_dense_format(conv_type)
Expand Down Expand Up @@ -176,7 +174,7 @@ def create_dataloaders(

batch_collate_function = self.__class__._get_collate_function(conv_type, precompute_multi_scale)
dataloader = partial(
torch.utils.data.DataLoader, collate_fn=batch_collate_function, worker_init_fn=lambda _: np.random.seed()
torch.utils.data.DataLoader, collate_fn=batch_collate_function, worker_init_fn=np.random.seed
)

if self.train_sampler:
Expand Down
2 changes: 1 addition & 1 deletion torch_points3d/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _initialize_trainer(self):

# Get device
if self._cfg.training.cuda > -1 and torch.cuda.is_available():
device = "cuda" + str(self._cfg.training.cuda)
device = "cuda"
torch.cuda.set_device(self._cfg.training.cuda)
else:
device = "cpu"
Expand Down

0 comments on commit 0a07f53

Please sign in to comment.