convaiinnovations commited on
Commit
bfd01f7
·
verified ·
1 Parent(s): 44a7695

fix: work on laya 0.3.2 too (PyPI index had not propagated 0.3.3)

Browse files
Files changed (1) hide show
  1. laya_routing.py +6 -1
laya_routing.py CHANGED
@@ -77,7 +77,12 @@ def attach_existing(agent):
77
  if router is None or agent is None:
78
  return False
79
  try:
80
- router.attach("english", agent)
 
 
 
 
 
81
  print("routing: reusing the already-built english checkpoint", flush=True)
82
  return True
83
  except Exception as e:
 
77
  if router is None or agent is None:
78
  return False
79
  try:
80
+ if hasattr(router, "attach"): # laya >= 0.3.3
81
+ router.attach("english", agent)
82
+ else: # 0.3.2: same effect, private path
83
+ router._agents["english"] = agent
84
+ router._touch("english")
85
+ router.max_loaded = max(router.max_loaded, len(router._agents))
86
  print("routing: reusing the already-built english checkpoint", flush=True)
87
  return True
88
  except Exception as e: