Add streaming preprocess mode for inference with optional disk persistence#29
Draft
vadanamu wants to merge 1 commit into
Draft
Add streaming preprocess mode for inference with optional disk persistence#29vadanamu wants to merge 1 commit into
vadanamu wants to merge 1 commit into
Conversation
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.
Motivation
.npzshards to disk before running inference, which adds I/O and prevents online inference.streammode that preprocesses POD5/BAM on-the-fly and feeds chunks directly to the inference pipeline while optionally allowing the same chunks to be persisted to disk.Description
deeprm call run:--preprocess-mode(disk|stream),--pod5,--stream-save-dir, and several--prep-*knobs to control streaming preprocess behavior.src/deeprm/inference/inference_preprocess_python.pywith_prepare_bam_dataframe,_list_pod5_paths,stream(...),dataframe_to_chunk(...), and makesegment_normalize_signal(...)emit in-memory chunk payloads via anemit_chunk_fnwhile optionally writing.npzviawrite_to_disk.src/deeprm/inference/inference.pyby adding_init_model_for_device(...)and_run_chunk_inference(...), and implementrun_inference_stream(...)to consume preprocessed chunks via callback and run inference without intermediate files.preprocess-mode=disk) and make streamed execution a drop-in alternative that can also persist streamed chunks when--stream-save-diris provided.Testing
python -m compileall -q src/deeprm/inference/inference.py src/deeprm/inference/inference_preprocess_python.pywhich succeeded.pytest -q tests/test_imports.pywhich passed.pytest -qwhich failed in this environment because CLI help tests invoke thedeeprmconsole script that is not installed on the PATH (automated failure unrelated to the diff logic).PYTHONPATH=src python -m deeprm call run --helpprinted a Torch availability message and did not proceed becausetorchis not installed in the test environment (environment limitation, not a code error).Codex Task