Update README.md
Browse files
README.md
CHANGED
@@ -80,11 +80,11 @@ def process_nli(premise: str, hypothesis: str):
|
|
80 |
|
81 |
|
82 |
# construct sequence of premise, hypothesis pairs
|
83 |
-
|
84 |
candidate_labels]
|
85 |
# format for mt5 xnli task
|
86 |
seqs = [process_nli(premise=premise, hypothesis=hypothesis) for
|
87 |
-
premise, hypothesis in
|
88 |
print(seqs)
|
89 |
# ['xnli: premise: ¿A quién vas a votar en 2020? hypothesis: Este ejemplo es Europa.',
|
90 |
# 'xnli: premise: ¿A quién vas a votar en 2020? hypothesis: Este ejemplo es salud pública.',
|
@@ -147,7 +147,6 @@ print(dict(zip(candidate_labels, entail_probas.tolist())))
|
|
147 |
# 'salud pública': 0.0004287279152777046,
|
148 |
# 'política': 0.9919371604919434}
|
149 |
|
150 |
-
|
151 |
```
|
152 |
|
153 |
Unfortunately, the `generate` function for the TF equivalent model doesn't exactly mirror the PyTorch version so the above code won't directly transfer.
|
|
|
80 |
|
81 |
|
82 |
# construct sequence of premise, hypothesis pairs
|
83 |
+
pairs = [(sequence_to_classify, hypothesis_template.format(label)) for label in
|
84 |
candidate_labels]
|
85 |
# format for mt5 xnli task
|
86 |
seqs = [process_nli(premise=premise, hypothesis=hypothesis) for
|
87 |
+
premise, hypothesis in pairs]
|
88 |
print(seqs)
|
89 |
# ['xnli: premise: ¿A quién vas a votar en 2020? hypothesis: Este ejemplo es Europa.',
|
90 |
# 'xnli: premise: ¿A quién vas a votar en 2020? hypothesis: Este ejemplo es salud pública.',
|
|
|
147 |
# 'salud pública': 0.0004287279152777046,
|
148 |
# 'política': 0.9919371604919434}
|
149 |
|
|
|
150 |
```
|
151 |
|
152 |
Unfortunately, the `generate` function for the TF equivalent model doesn't exactly mirror the PyTorch version so the above code won't directly transfer.
|