Created
November 30, 2025 02:00
-
-
Save thistleknot/f9697dd6943e77bb1af8ba4ab37cdfc2 to your computer and use it in GitHub Desktop.
cross encoder
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
| from sentence_transformers import CrossEncoder | |
| MODEL_NAME = 'cross-encoder/ms-marco-MiniLM-L12-v2' | |
| nli_model = CrossEncoder(MODEL_NAME) | |
| m2v_model = distill(model_name=MODEL_NAME) | |
| query = "Explain quantum computing" | |
| # Generate SAPO response group | |
| responses = [ | |
| "Quantum computing uses qubits that can be 0 and 1 simultaneously", | |
| "It's when computers get really fast", | |
| "I don't know what that is" | |
| ] | |
| # NLI model EXPECTS: [premise, hypothesis] PAIRS | |
| scores = nli_model.predict([ | |
| (query, r) for r in responses # ← Treating query as premise! | |
| ]) | |
| print(scores) | |
| # [ 4.2502446 -10.693266 -10.976209 ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment