fix: apply finetuning_mods (APE + per-axis RoPE) before load for PNS ft ckpt
Browse files115 unmodified lines116117118119120121122115 unmodified linesfmap = dm.train_dataset.field_to_index_mapn_states = max(fmap.values()) + 1model = instantiate(config.model, n_states=n_states)model.load_state_dict(checkpoint)model.to(device).eval()formatter = ChannelsFirstWithTimeFormatter()revin = instantiate(config.trainer.revin)()115 unmodified lines116117118119120121122123124125126127128129130131132133134135136137115 unmodified linesfmap = dm.train_dataset.field_to_index_mapn_states = max(fmap.values()) + 1model = instantiate(config.model, n_states=n_states)# Faithful fine-tune arch (train.py:136-138): finetuning_mods are applied to# the model AFTER instantiation, BEFORE loading weights. Base ckpt has# finetuning_mods={} (no-op, loads clean). The PNS ft ckpt adds `ape` +# per-axis learnable RoPE (`...rotary_emb.freqs.0/.1/.2`), so without this the# released ft state_dict mismatches the config-instantiated model.fmods = config.get("finetuning_mods", None) or {}if len(fmods) and hasattr(model, "add_ft_options"):print(f">>> applying finetuning_mods: {OmegaConf.to_container(fmods)}", flush=True)model.add_ft_options(fmods)try:model.load_state_dict(checkpoint, strict=True)except RuntimeError:incompat = model.load_state_dict(checkpoint, strict=False)print(f">>> load_state_dict strict FAILED; missing={list(incompat.missing_keys)[:12]} "f"unexpected={list(incompat.unexpected_keys)[:12]}", flush=True)raisemodel.to(device).eval()formatter = ChannelsFirstWithTimeFormatter()revin = instantiate(config.trainer.revin)()
rollout_eval.py+16-1