Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Score Postprocessing in QA Task for English and French Versions #613

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions chapters/en/chapter6/3b.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -242,20 +242,20 @@ scores = start_probabilities[:, None] * end_probabilities[None, :]

{#if fw === 'pt'}

Then we'll mask the values where `start_index > end_index` by setting them to `0` (the other probabilities are all positive numbers). The `torch.triu()` function returns the upper triangular part of the 2D tensor passed as an argument, so it will do that masking for us:
Then we'll mask the values where `start_index >= end_index` by setting them to `0` (the other probabilities are all positive numbers). The `torch.triu()` function with `diagonal=1` returns the strictly upper triangular part of the 2D tensor passed as an argument, so it will do that masking for us:

```py
scores = torch.triu(scores)
scores = torch.triu(scores, diagonal=1)
```

{:else}

Then we'll mask the values where `start_index > end_index` by setting them to `0` (the other probabilities are all positive numbers). The `np.triu()` function returns the upper triangular part of the 2D tensor passed as an argument, so it will do that masking for us:
Then we'll mask the values where `start_index >= end_index` by setting them to `0` (the other probabilities are all positive numbers). The `np.triu()` function with `k=1` returns the strictly upper triangular part of the 2D tensor passed as an argument, so it will do that masking for us:

```py
import numpy as np

scores = np.triu(scores)
scores = np.triu(scores, k=1)
```

{/if}
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 @@ -288,18 +288,18 @@ scores = start_probabilities[:, None] * end_probabilities[None, :]

{#if fw === 'pt'}

Ensuite, nous masquerons les valeurs où `start_index > end_index` en les mettant à `0` (les autres probabilités sont toutes des nombres positifs). La fonction `torch.triu()` renvoie la partie triangulaire supérieure du tenseur 2D passé en argument, elle fera donc ce masquage pour nous :
Ensuite, nous masquerons les valeurs où `start_index >= end_index` en les mettant à `0` (les autres probabilités sont toutes des nombres positifs). La fonction `torch.triu()` avec `diagonal=1` renvoie la partie strictement triangulaire supérieure du tenseur 2D passé en argument, elle fera donc ce masquage pour nous :

```py
scores = torch.triu(scores)
scores = torch.triu(scores, diagonal=1)
```

{:else}

Ensuite, nous masquerons les valeurs où `start_index > end_index` en les mettant à `0` (les autres probabilités sont toutes des nombres positifs). La fonction `np.triu()` renvoie la partie triangulaire supérieure du tenseur 2D passé en argument, elle fera donc ce masquage pour nous :
Ensuite, nous masquerons les valeurs où `start_index >= end_index` en les mettant à `0` (les autres probabilités sont toutes des nombres positifs). La fonction `np.triu()` avec `k=1` renvoie la partie strictement triangulaire supérieure du tenseur 2D passé en argument, elle fera donc ce masquage pour nous :

```py
scores = np.triu(scores)
scores = np.triu(scores, k=1)
```

{/if}
Expand Down
Loading