Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

gpt return correct data structure #75

Merged
merged 2 commits into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ For single-device models, they require manual coding works to introduce tensor p

At present, we pre-build distributed Bert and GPT models.
For GPT, it extends to at most 175B parameters, which is called [GPT3](https://arxiv.org/abs/2005.14165).
For Bert, Google reports a [super-large Bert with 481B parameters](https://mlcommons.org/en/training-normal-11/) in MLPerf-Training v1.1 open.
For Bert, Google reports a [super-large Bert with 481B parameters](https://mlcommons.org/en/training-normal-11/) in MLPerf-Training v1.1 open, indicating that Bert can also extend to large-scale.

### Installation
``` bash
Expand Down
10 changes: 5 additions & 5 deletions examples/gpt/gpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,11 @@ def forward(self, hidden_states=None, input_ids=None, attention_mask=None, seq_l
if seq_lens is not None:
hidden_states = ft_rebuild_padding(hidden_states, self.tmp_mask_offset[0:self.valid_word_num[0].item()], self.valid_word_num[0].item(), self.dim, batch_size, max_padding_size)
hidden_states = self.head(self.norm(hidden_states))
# res = []
# for i in range(hidden_states.shape[0]):
# res.append(self.select_top_k(i, hidden_states))
# hidden_states = torch.Tensor(res)
hidden_states = hidden_states[:, 0:1, 0:1].view(batch_size)
res = []
for i in range(hidden_states.shape[0]):
res.append(self.select_top_k(i, hidden_states))
hidden_states = torch.Tensor(res)
# hidden_states = hidden_states[:, 0:1, 0:1].view(batch_size)
return hidden_states


Expand Down