Merge branch 'Vision-CAIR:main' into main

This commit is contained in:
ZhuDeyao 2023-10-23 22:09:12 +03:00 committed by GitHub
commit f118d7da6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,7 +75,7 @@ class LlamaForCausalLM(LlamaForCausalLMOrig):
)
hidden_states = outputs[0]
if self.config.pretraining_tp > 1:
if hasattr(self.config, 'pretraining_tp') and self.config.pretraining_tp > 1:
lm_head_slices = self.lm_head.weight.split(self.vocab_size // self.config.pretraining_tp, dim=0)
logits = [F.linear(hidden_states, lm_head_slices[i]) for i in range(self.config.pretraining_tp)]
logits = torch.cat(logits, dim=-1)