Skip to content

Fix missing-modality aggregation widths#1

Open
AbdelStark wants to merge 1 commit intofacebookresearch:mainfrom
AbdelStark:fix/missing-modality-aggregation
Open

Fix missing-modality aggregation widths#1
AbdelStark wants to merge 1 commit intofacebookresearch:mainfrom
AbdelStark:fix/missing-modality-aggregation

Conversation

@AbdelStark
Copy link
Copy Markdown

Summary

This fixes the missing-modality fallback path in FmriEncoderModel.

Before this patch, absent modalities were always zero-filled with width hidden / n_modalities, which is only correct for extractor_aggregation="cat". For sum and stack, projectors emit full hidden width, so modality ablations or partially missing feature sets could produce shape mismatches or incorrect aggregation.

Changes

  • track the projected output width for each modality during model construction
  • use the tracked width when a modality is absent from the batch or has no projector
  • add focused regression tests for cat, sum, and stack
  • add coverage for the feature_dims[modality] is None path

Validation

  • .venv-tests/bin/python -m pytest -q tests/test_model_missing_modalities.py
  • result: 7 passed

This keeps the existing cat behavior unchanged while making the other supported aggregation modes shape-safe.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 26, 2026
armaanparikh added a commit to armaanparikh/tribev2 that referenced this pull request Apr 20, 2026
Previously each job spent ~11 commits (upload-url meta, launch meta,
6 progress patches in Python, 4 per-file uploads). Burned the 128/hour
budget after ~12 jobs.

New flow: 2 commits per job.
- /api/upload-url: no commit (just returns repo/path/token).
- Browser upload to HF:                            commit facebookresearch#1
- /api/jobs: writes meta.json once with hfJobId:   commit facebookresearch#2 (server-side)
- /api/jobs/[id]: read-only; derives status from  file existence +
  HF inspect. Never commits.
- tribe_predict.py: uses upload_folder to batch preds.npy, overlays,
  and preds_meta.json into a single commit. Drops _patch_meta progress
  updates (HF inspect stage is enough for UI messaging).

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant