Open QuantumMisaka opened 2 weeks ago
Finetune with numb_steps: 0
will save only one head model, while change-bias
will keep multi-head model, which is expected.
Finetune with
numb_steps: 0
will save only one head model, whilechange-bias
will keep multi-head model, which is expected.
Thanks! However the oversize of change-bias
model is also a problem
@QuantumMisaka could you post all keys in the checkpoint
import torch
def get_all_keys(d, prefix=""):
"""Gets all keys from a nested dictionary with slash-separated paths."""
keys = []
for k, v in d.items():
if isinstance(v, dict):
keys.extend(get_all_keys(v, prefix + str(k) + "/"))
else:
keys.append(prefix + str(k))
return keys
print(get_all_keys(torch.load("dpa230m.pt")))
print(get_all_keys(torch.load("dpa230m_updated.pt")))
@njzjz They print the same results
(base) [2201110432@wm2-data01 fine2]$ diff allkeys_base.txt allkeys_cbias.txt
(base) [2201110432@wm2-data01 fine2]$
The reason should be the abuse of deepcopy
(or the copy of tensors that happens in other places)
Bug summary
From pre-trained multi-head model,
dp --pt change-bias
will give a model with much larger size. However, finetuen withnumb_steps: 0
will have no problem:the model after change-bias dpa230m_updated.pt have much larger size even more than original model, but the 0-step finetuned model model_finetune.ckpt-0.pt have much small size which is in desire.
And, if try to load the model after change-bias, the head should be selected, which is also not in desire
Where the 0-step finetuned model have no problem
DeePMD-kit Version
v3.0.0b4
Backend and its version
pytorch 2.5.1
How did you download the software?
Offline packages
Input Files, Running Commands, Error Log, etc.
command for change-bias:
command for 0-step finetune
coresponding input.json
Steps to Reproduce
run these command in any dataset
Further Information, Files, and Links
No response