Skip to content

Commit

Permalink
Fix question answering indices (#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
lewtun authored Oct 4, 2022
1 parent 4cd2c0e commit 85019bc
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions chapters/en/chapter6/3b.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,8 @@ for start_probs, end_probs in zip(start_probabilities, end_probabilities):
scores = start_probs[:, None] * end_probs[None, :]
idx = torch.triu(scores).argmax().item()

start_idx = idx // scores.shape[0]
end_idx = idx % scores.shape[0]
start_idx = idx // scores.shape[1]
end_idx = idx % scores.shape[1]
score = scores[start_idx, end_idx].item()
candidates.append((start_idx, end_idx, score))

Expand All @@ -592,8 +592,8 @@ for start_probs, end_probs in zip(start_probabilities, end_probabilities):
scores = start_probs[:, None] * end_probs[None, :]
idx = np.triu(scores).argmax().item()

start_idx = idx // scores.shape[0]
end_idx = idx % scores.shape[0]
start_idx = idx // scores.shape[1]
end_idx = idx % scores.shape[1]
score = scores[start_idx, end_idx].item()
candidates.append((start_idx, end_idx, score))

Expand Down
8 changes: 4 additions & 4 deletions chapters/fr/chapter6/3b.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -654,8 +654,8 @@ for start_probs, end_probs in zip(start_probabilities, end_probabilities):
scores = start_probs[:, None] * end_probs[None, :]
idx = torch.triu(scores).argmax().item()

start_idx = idx // scores.shape[0]
end_idx = idx % scores.shape[0]
start_idx = idx // scores.shape[1]
end_idx = idx % scores.shape[1]
score = scores[start_idx, end_idx].item()
candidates.append((start_idx, end_idx, score))

Expand All @@ -670,8 +670,8 @@ for start_probs, end_probs in zip(start_probabilities, end_probabilities):
scores = start_probs[:, None] * end_probs[None, :]
idx = np.triu(scores).argmax().item()

start_idx = idx // scores.shape[0]
end_idx = idx % scores.shape[0]
start_idx = idx // scores.shape[1]
end_idx = idx % scores.shape[1]
score = scores[start_idx, end_idx].item()
candidates.append((start_idx, end_idx, score))

Expand Down
8 changes: 4 additions & 4 deletions chapters/th/chapter6/3b.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,8 @@ for start_probs, end_probs in zip(start_probabilities, end_probabilities):
scores = start_probs[:, None] * end_probs[None, :]
idx = torch.triu(scores).argmax().item()

start_idx = idx // scores.shape[0]
end_idx = idx % scores.shape[0]
start_idx = idx // scores.shape[1]
end_idx = idx % scores.shape[1]
score = scores[start_idx, end_idx].item()
candidates.append((start_idx, end_idx, score))

Expand All @@ -599,8 +599,8 @@ for start_probs, end_probs in zip(start_probabilities, end_probabilities):
scores = start_probs[:, None] * end_probs[None, :]
idx = np.triu(scores).argmax().item()

start_idx = idx // scores.shape[0]
end_idx = idx % scores.shape[0]
start_idx = idx // scores.shape[1]
end_idx = idx % scores.shape[1]
score = scores[start_idx, end_idx].item()
candidates.append((start_idx, end_idx, score))

Expand Down
8 changes: 4 additions & 4 deletions chapters/vi/chapter6/3b.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,8 @@ for start_probs, end_probs in zip(start_probabilities, end_probabilities):
scores = start_probs[:, None] * end_probs[None, :]
idx = torch.triu(scores).argmax().item()

start_idx = idx // scores.shape[0]
end_idx = idx % scores.shape[0]
start_idx = idx // scores.shape[1]
end_idx = idx % scores.shape[1]
score = scores[start_idx, end_idx].item()
candidates.append((start_idx, end_idx, score))

Expand All @@ -592,8 +592,8 @@ for start_probs, end_probs in zip(start_probabilities, end_probabilities):
scores = start_probs[:, None] * end_probs[None, :]
idx = np.triu(scores).argmax().item()

start_idx = idx // scores.shape[0]
end_idx = idx % scores.shape[0]
start_idx = idx // scores.shape[1]
end_idx = idx % scores.shape[1]
score = scores[start_idx, end_idx].item()
candidates.append((start_idx, end_idx, score))

Expand Down
8 changes: 4 additions & 4 deletions chapters/zh-CN/chapter6/3b.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,8 @@ for start_probs, end_probs in zip(start_probabilities, end_probabilities):
scores = start_probs[:, None] * end_probs[None, :]
idx = torch.triu(scores).argmax().item()

start_idx = idx // scores.shape[0]
end_idx = idx % scores.shape[0]
start_idx = idx // scores.shape[1]
end_idx = idx % scores.shape[1]
score = scores[start_idx, end_idx].item()
candidates.append((start_idx, end_idx, score))

Expand All @@ -589,8 +589,8 @@ for start_probs, end_probs in zip(start_probabilities, end_probabilities):
scores = start_probs[:, None] * end_probs[None, :]
idx = np.triu(scores).argmax().item()

start_idx = idx // scores.shape[0]
end_idx = idx % scores.shape[0]
start_idx = idx // scores.shape[1]
end_idx = idx % scores.shape[1]
score = scores[start_idx, end_idx].item()
candidates.append((start_idx, end_idx, score))

Expand Down

0 comments on commit 85019bc

Please sign in to comment.