veridian-lqis / inference.py
sumitnewold's picture
LQIS: weights + src + model card
d2724b0 verified
Raw
History Blame Contribute Delete
1.3 kB
"""Veridian.ai / LQIS — minimal inference example.
pip install -r requirements.txt
python inference.py
Loads the trained pipeline (weights in models/) and scores a sample negotiation,
printing the loss probability, the turn where the deal tipped, and coaching.
"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
from src.inference.live_scorer import LiveScorer # noqa: E402
def main():
scorer = LiveScorer.build() # loads models/ (encoder + temporal + FiLM + calibration)
dialogue = [
{"speaker": "buyer", "text": "Is the charger still available?"},
{"speaker": "seller", "text": "Yes, asking $10."},
{"speaker": "buyer", "text": "That is way too expensive, $4 is my max."},
{"speaker": "seller", "text": "I could maybe do $8."},
{"speaker": "buyer", "text": "No. $4 or I am done, not paying more."},
]
out = scorer.score(dialogue, fetch_external=False)
print(f"trained model : {not out['untrained']}")
print(f"loss_probability : {out['loss_probability']:.3f}")
print(f"deal tipped at turn : {out['tipping_turn']}")
print("coaching :")
for c in out["coaching"]:
print(f" - {c['message']}")
if __name__ == "__main__":
main()