anuj-inavlabs/ThinkSpark-4.4M main
References multiple AI or ML asset extensionsLoads a PyTorch checkpoint
SHA-256a6e2875ef05b5fa3356a2dd4b0434ca852d9b93bd0b8a3220ad1476e97e148e1
MaleculeH₂(Db₂F)
Evidence
4:13… , then samples a surface form. Sampling prefers the corpus-derived
5filler_dictionary.json (real observed fillers) and falls back to the curated
6LEXICON in config/taxonomy.py, so an untrained/edge combo still speaks.
7"""
⋯11 lines
22:15… port ThinkSpark
23
24# script tag -> language codes that use it (e.g. "Deva" -> ["hi", "mr"])
25_SCRIPT_TO_LANGS: dict[str, list[str]] = {}
26for _code, _meta in LANGUAGES.items():
27 _SCRIPT_TO_LANGS.setdefault(_meta["script"], []).append( …
63:51… None = None):
64 ckpt_dir = Path(ckpt_dir)
65 meta = json.loads((ckpt_dir / "meta.json").read_text(encoding="utf-8"))
66 self.labels = json.loads((ckpt_dir / "label_maps.json").read_text(encoding="utf-8"))
67 mcfg = _ModelCfg(meta["model_cfg"])
68 dcfg = meta["data_cfg"]
80:86… n,
81 ).to(self.device)
82 self.model.load_state_dict(torch.load(ckpt_dir / "model.pt", map_location=self.device))
83 self.model.eval()
84
85 # intent label list from the checkpoint (super scheme by default …
152:60… s decisive: if the raw
153 argmax disagrees with the input's dominant script, re-pick the highest-
154 probability language that actually uses that script. This makes language
155 essentially perfect for Devanagari/Gujarati/Tamil/… inputs and only le …