Skip to content

Commit

Permalink
fix flagai/model/llama_model.py.
Browse files Browse the repository at this point in the history
Signed-off-by: ftgreat <[email protected]>
  • Loading branch information
ftgreat authored and gitee-org committed May 26, 2023
1 parent d931619 commit 0206658
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions flagai/model/llama_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,8 @@ def forward(self, input_ids: torch.Tensor, start_pos=0, labels=None, **kwargs):
layer.start_pos = start_pos
h = layer(h, freqs_cis, mask)


h = self.norm(h)
if labels is not None:
h = self.norm(h)
if self.config.checkpoint_activations:
h = checkpoint(create_custom_forward(self.output),h)
else:
Expand Down Expand Up @@ -254,7 +253,6 @@ def forward(self, input_ids: torch.Tensor, start_pos=0, labels=None, **kwargs):
'hidden_states': h,
}
else :

output = self.output(h[:, -1, :]) # only compute last logits
return {
"logits": output.float()
Expand Down

0 comments on commit 0206658

Please sign in to comment.