Skip to content

fix(retrieval): preserve bi-encoder export metadata#2905

Draft
oliverholworthy wants to merge 1 commit into
mainfrom
oholworthy/fix/retrieval-export-metadata
Draft

fix(retrieval): preserve bi-encoder export metadata#2905
oliverholworthy wants to merge 1 commit into
mainfrom
oholworthy/fix/retrieval-export-metadata

Conversation

@oliverholworthy

Copy link
Copy Markdown
Contributor

What does this PR do?

Preserves bi-encoder wrapper settings in consolidated exports and restores them when the export is loaded again.

Changelog

  • Persist retrieval task, pooling, and L2-normalization metadata on saved encoder configs.
  • Restore metadata from config.json or the AutoModel v5 sidecar while preserving explicit loader overrides.
  • Register bidirectional Llama and Ministral configs with Hugging Face auto classes.
  • Add a helper that re-exports older HF-loadable bi-encoders with explicit retrieval metadata.
  • Add focused registry, retrieval-loader, and bi-encoder tests.

Before your PR is "Ready for review"

Pre checks:

  • Read and followed the contributor guidelines.
  • Added focused CPU-compatible tests.
  • Added the migration helper required by the documented mining workflow.
  • All commits include DCO sign-off.

Validation

  • uv run ruff format <changed files>
  • uv run ruff check --fix <changed files>
  • uv run pytest tests/unit_tests/_transformers/test_registry.py tests/unit_tests/_transformers/test_retrieval.py tests/unit_tests/models/bi_encoder/test_llama_bidirectional_model.py -q (63 passed)
  • uv run python examples/retrieval/data_utils/export_biencoder_with_metadata.py --help

Additional Information

Extracted from #2306 so that the fine-tuning documentation PR does not carry model-loading behavior.

Signed-off-by: Oliver Holworthy <1216955+oliverholworthy@users.noreply.github.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant