MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / save

Method save

uncommon_route/router/learned.py:210–224  ·  view source on GitHub ↗
(self, path: Path)

Source from the content-addressed store, hash-verified

208 return (complexity, best, probs[best])
209
210 def save(self, path: Path) -> None:
211 data = {
212 "avg_weights": {
213 t: {k: v for k, v in w.items() if abs(v) > 1e-6}
214 for t, w in self._avg_weights.items()
215 },
216 "weights": {
217 t: {k: v for k, v in w.items() if abs(v) > 1e-6}
218 for t, w in self._weights.items()
219 },
220 "update_count": self._update_count,
221 "use_ngrams": self._use_ngrams,
222 }
223 path.parent.mkdir(parents=True, exist_ok=True)
224 path.write_text(json.dumps(data))
225
226 @classmethod
227 def _collapse_loaded_weights(

Callers 2

train_and_save_modelFunction · 0.95
save_online_modelFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected