model = BloomForCausalLM.from_pretrained(path)
model = bmt.BMTrainModelWrapper(model)
print_inspect(model, "*")
打印报错:
File "/work/openBMB/BMTrain/bmtrain/inspect/model.py", line 227, in inspect_model
return func(*args, **kwargs)
File "/work/openBMB/BMTrain/bmtrain/inspect/model.py", line 227, in inspect_model
'shape': tuple(p.size()),
AttributeError'shape': tuple(p.size()),:
'NoneType' object has no attribute 'size'
Is there an existing issue for this?
Description of the Bug
model = BloomForCausalLM.from_pretrained(path) model = bmt.BMTrainModelWrapper(model) print_inspect(model, "*")
打印报错: File "/work/openBMB/BMTrain/bmtrain/inspect/model.py", line 227, in inspect_model return func(*args, **kwargs) File "/work/openBMB/BMTrain/bmtrain/inspect/model.py", line 227, in inspect_model 'shape': tuple(p.size()), AttributeError'shape': tuple(p.size()),: 'NoneType' object has no attribute 'size'
主要原因bloom模型有self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)。 lm_head weight
tensor([[ 1.3199e-03, 2.2888e-03, -1.2589e-03, ..., 1.3962e-03, -1.2054e-03, -1.0757e-03], [ 8.5449e-04, 2.4872e-03, 3.2783e-06, ..., 5.3711e-03, -6.6223e-03, -2.6855e-03], [ 2.4719e-03, -8.7280e-03, -3.5286e-04, ..., -5.4016e-03, 1.3306e-02, -2.9602e-03], ..., [ 1.3123e-03, 3.7689e-03, -3.9673e-04, ..., 1.3962e-03, -7.5150e-04, -9.9945e-04], [ 1.3123e-03, 3.7689e-03, -3.9673e-04, ..., 1.3962e-03, -7.5150e-04, -9.9945e-04], [ 1.3123e-03, 3.7689e-03, -3.9673e-04, ..., 1.3962e-03, -7.5150e-04, -9.9945e-04]], device='cuda:0') bias
None
Environment Information
To Reproduce
如描述所述,用BMTrainModelWrapper封装bloom模型,必现
Expected Behavior
无
Screenshots
No response
Additional Information
No response
Confirmation