Fix #1474 - AssertionError:assert param_slice.shape == loaded_weight.shape (#1631)

This commit is contained in:
lirui
2023-11-13 07:53:12 +08:00
committed by GitHub
parent 1b290ace4f
commit eb825c1e74

View File

@ -250,7 +250,7 @@ class GPTJForCausalLM(nn.Module):
if att_weight_name not in name:
continue
param = state_dict[name.replace(att_weight_name, "qkv_proj")]
shard_size = param.shape[1]
shard_size = param.shape[0] // 3
loaded_weight = loaded_weight[shard_size * tp_rank:shard_size *
(tp_rank + 1)]
param_slice = param.data[shard_size * stride_id:shard_size *