Repository navigation
ink inference: optional vc_reader backend for full-3D patch reads - #2226
Closed
phippsrtyler wants to merge 3 commits into
Closed
phippsrtyler wants to merge 3 commits into
phippsrtyler wants to merge 3 commits into
Conversation
|
@phippsrtyler is attempting to deploy a commit to the scroll Team on Vercel. A member of the Team first needs to authorize it. |
--reader vc_reader reads each DataLoader batch of planned patches with one vc_reader read_regions call, so chunks shared by overlapping patches are fetched once and in parallel. The default zarr reader is unchanged.
phippsrtyler
force-pushed
the
ink-vc-reader
branch
from
October 22, 2026 14:40
9ebcb95 to
5e43f33
Compare
Contributor
Author
|
This one's done on my end, with proof rows on 3 cards. I'm at the 3-open-PR limit, so I can't mark it ready. Happy for it to go into review whenever a slot opens, or I can close one of my others if you'd rather review this first. |
Member
|
handled in #2440 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In one sentence:
infer_full3d_tifxyz --reader vc_readerloaded remote full-3D patches about 2x faster in my runs (36.6 → 18.1 s for 45 patches of PHerc Paris 4) by reading each DataLoader batch with one vc_readerread_regionscall. The patches are bit-identical, and the default zarr reader is unchanged.One real example: 45 planned 128³ patches (overlap 0.5) on the public PHerc Paris 4 7.91 µm volume over HTTPS. The inference DataLoader used batch 8, 4 spawn workers and prefetch factor 2. A pass took 36.6 s with the default zarr reader and 18.1 s with
--reader vc_reader(median of 3 interleaved rounds).Before:
NativePatchDatasetread every patch with its ownread_bbox_with_paddingzarr slice.After this PR:
volume_io.open_vc_readeropens one level with villa'svc_reader.volume_io.read_bboxes_with_paddingreads several bboxes with the same padding contract asread_bbox_with_padding.read_regionscall, so shared chunks are read once and in parallel.read_bbox_with_padding.NativePatchDatasetchanges:__getitems__, which DataLoader calls once per batch.reader,reader_connectionsandreader_memory_cache_mb(defaultszarr, 32, 512).__getitem__is now the one-item case of__getitems__.--reader {zarr,vc_reader},--reader-connections,--reader-memory-cache-mb.--reader vc_readeris given without the package.Proof:
--reader zarr--reader vc_readertest_read_bboxes_with_padding_matches_single_readsuses a stubread_regionsvolume that fills with 7 and returns views. It checks padding, valid slices and a single call againstread_bbox_with_padding.test_vc_reader_matches_zarr_readsreads a local zarr through real vc_reader, including boxes partly outside it. It is skipped when vc_reader is absent.test_open_vc_reader_without_package_says_how_to_fixchecks the error when the package is missing.test_native_dataset_vc_reader_batches_match_zarr_readschecks that DataLoader batches match zarr reads, with one read per batch.test_native_full3d_inference+test_volume_io: 30 passed with the latest commits.Why / where this is useful:
Training and running 3D ink models straight from raw, unflattened CT means streaming many overlapping 128³ patches from a remote scroll zarr, and the loader is the bottleneck. On my PC, the 45-patch inference pass went from about 18 s to 10 s with
--reader vc_reader(1.7–1.8x, identical patches, two quiet repeats). This PR lets the full-3D inference loader use villa's fast reader with one flag, and the same helper is ready for training datasets.Details
connections=32and the 512 MB memory cache are the measured best settings.TimeoutError, and an earlier sweep failed on a DNS error. vc_reader did not fail in these runs.CoordPatchDatasetis built inside aConcatDataset, which does not forward__getitems__. Per-batch reads only gained 1.18x there (67.0 → 57.0 s, 64 random 128³ patches, noisy).prefetch_windowis the better tool. In a standalone loop it gave 1.5–1.8x over plainread_regions.open_volume's auth JSON and zarr2 fallback are not applied on the vc_reader path.