Add generic data tiling wrapper to solve padding consistency#1140
Add generic data tiling wrapper to solve padding consistency#1140ahmedemam576 wants to merge 5 commits intoterrastackai:mainfrom
Conversation
- Implement TilingDataModuleWrapper for any LightningDataModule - Implement TiledDataset with on-the-fly tiling and disk caching - Add 16 comprehensive integration tests (all passing) - Support sliding/tumbling window modes with configurable overlap - Provide prediction stitching with smooth blending - Include end-to-end inference demo
930165d to
5198d8f
Compare
|
Updated this draft PR with example cleanup and validation.
|
rosielickorish
left a comment
There was a problem hiding this comment.
These two pytests are failing for me with these changes:
FAILED tests/test_finetune.py::test_finetune_multiple_backbones[fit-terramind_v1_base] - RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces)....
py::test_finetune_multiple_backbones_with_prediction[terramind_v1_small] - RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces)....
FAILED tests/test_finetune.
|
|
||
| **See Also:** | ||
| - TiledDataset: Underlying dataset wrapper | ||
| - docs/tiling_datamodule_wrapper.md: Comprehensive documentation |
There was a problem hiding this comment.
This file doesn't exist.
|
|
||
| print("=" * 70) | ||
| print("For more details, see:") | ||
| print(" docs/tiling_datamodule_wrapper.md") |
There was a problem hiding this comment.
This file doesn't exist.
There was a problem hiding this comment.
Hey @rosielickorish thanks for the feedback. I am gonna fix the issues
There was a problem hiding this comment.
I was expected a notebook to make it easy to run through an example of tiling. Would that be more useful here than this python script? Otherwise, the docstrings in the other files give a pretty good description on how to use this.
…late function - Fix RuntimeError: 'view size is not compatible with input tensor's size and stride' in test_finetune_multiple_backbones tests - Add .contiguous() after torch.nn.functional.pad() for all tensor dimensions (2D, 3D, 4D) in custom collate function - Tensor padding can create non-contiguous memory layouts which fail on reshape - Add documentation file (was untracked) - Add Jupyter notebook tutorial demonstrating the fix and TiledDataModuleWrapper usage - Fixes issues raised by @rosielickorish in PR review
rosielickorish
left a comment
There was a problem hiding this comment.
Looks good. Just a few points on the notebook to clear up still. Failing tests now passing.
| "id": "0130a6d9", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "## Section 6: Summary of Fixes\n", |
There was a problem hiding this comment.
Why is it starting with Section 6?
| "- 3D tensors: [C, H, W]\n", | ||
| "- 4D tensors: [B, C, H, W]\n", | ||
| "\n", | ||
| "### Why This Fixes the Tests\n", |
| }, | ||
| "nbformat": 4, | ||
| "nbformat_minor": 5 | ||
| } |
There was a problem hiding this comment.
This is the only example in the examples/notebooks directory. All others are in example/<some_description>, so it might be best to move this to match the other examples.
…ontent - Moved notebook from examples/notebooks/ to examples/utils/ - Updated and improved notebook code content
07d7d22 to
c1d8a27
Compare
This PR addresses both issues #1079 and #1091