fix(intern-decision-serve): register the checkpoint's inference module before executing it

Its dataclasses use postponed annotations and look their module up in sys.modules while the
class is built; importing by file path without registering it failed startup (closed).
This commit is contained in:
vh
2026-09-30 09:08:19 -07:00
parent cc211ef10c
commit f7415db5c9
2 changed files with 18 additions and 5 deletions
@@ -89,15 +89,17 @@ def reset_fake_torch():
# A fake checkpoint: snapshots/<REVISION>/inference.py defining a DecisionEngine shaped like the real one.
# ---------------------------------------------------------------------------------------------
FAKE_INFERENCE = textwrap.dedent('''
from __future__ import annotations # as in the real one: dataclasses then look the module up in sys.modules
import json
from dataclasses import dataclass
MODEL_NAME = "Intern-Decision-4B"
EVENTS = []
WARMUP_SHIFT = {"after_swap": 0.0}
TOKEN_SKEW = {"n": 0}
@dataclass(frozen=True) # the real inference.py defines one: needs sys.modules at exec time
class Compiled:
def __init__(self, messages):
self.messages = messages
messages: list
def validate_request(request):
return {"state": request["state"], "questions": request["questions"]}