Speed up warm CatPred inference path#41
Merged
Vedasheersh merged 1 commit intoJun 14, 2026
Merged
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.
Summary
CATPRED_LOCAL_SUBPROCESS=1.CATPRED_ESM_BATCH_SIZE=1) and batched on GPU (4), with recursive OOM fallback and an env override.Benchmarks
Local macOS CPU, conda env
esm, 2-row demo inputs, production checkpoints, 3 measured runs with 1 in-process warmup:kcatkmkiOutput equivalence vs legacy subprocess was verified for predictions and uncertainty fields:
kcat: max abs diff1.11e-16km: max abs diff3.89e-16ki: max abs diff2.22e-16Additional ESM-cache checks:
kcat, batch size 1:7.733 s, matching prior subprocess output exactly up to existingSD_aleatoricnoise (1.11e-16).kcat, batch size 4:10.564 s; this was slower for short CPU rows, so CPU defaults to 1.kcat: Tesla T4,cuda_available=true,row_count=2, approximately16 s, and wrote 2 ESM cache entries.Modal GPU smoke verification:
kcat,km, andkieach completed 1-row inference on Tesla T4 withcuda_available=true.*_mve_uncal_aleatoric_varand*_mve_uncal_epistemic_var.Tests
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest tests/test_inference_fast_path.py tests/test_postprocess_predictions.py tests/test_esm_batching.py -vPYTHONDONTWRITEBYTECODE=1 conda run -n esm python -m unittest tests/test_postprocess_predictions.py tests/test_esm_batching.py -vPYTHONDONTWRITEBYTECODE=1 python3 -m py_compile catpred/args.py catpred/data/cache_utils.py catpred/data/esm_utils.py catpred/data/utils.py catpred/inference/__init__.py catpred/inference/backends.py catpred/inference/service.py catpred/train/make_predictions.py catpred/train/predict.py catpred/uncertainty/uncertainty_estimator.py catpred/uncertainty/uncertainty_predictor.py modal_app.py scripts/benchmark_inference.py tests/test_inference_fast_path.py tests/test_postprocess_predictions.py tests/test_esm_batching.pyPYTHONDONTWRITEBYTECODE=1 conda run -n esm python scripts/benchmark_inference.py --helpNotes
This now covers the first deeper ESM pass: persistent caches, CPU/GPU-shareable cache values, unique-sequence materialization, GPU batching, and OOM fallback. A larger future step would be a dedicated long-lived ESM service/worker for high-throughput API deployments.