Update README.md
Browse filesFix the mistake in context + question in the "prepare_answering_input" function
README.md
CHANGED
@@ -51,12 +51,12 @@ The sliding Foxes, who ended with 10 men following Wout Faes' late dismissal for
|
|
51 |
>>> selected_answer = options[np.argmax(prob)]
|
52 |
|
53 |
>>> print(prob)
|
54 |
-
[0.
|
55 |
>>> print(selected_answer)
|
56 |
Joao Felix
|
57 |
```
|
58 |
|
59 |
-
where the function
|
60 |
|
61 |
```python
|
62 |
def prepare_answering_input(
|
@@ -66,7 +66,7 @@ def prepare_answering_input(
|
|
66 |
context, # str
|
67 |
max_seq_length=4096,
|
68 |
):
|
69 |
-
c_plus_q =
|
70 |
c_plus_q_4 = [c_plus_q] * len(options)
|
71 |
tokenized_examples = tokenizer(
|
72 |
c_plus_q_4, options,
|
@@ -84,7 +84,6 @@ def prepare_answering_input(
|
|
84 |
return example_encoded
|
85 |
```
|
86 |
|
87 |
-
|
88 |
## Related Models
|
89 |
- Question/Answering Generation ```Context ---> Question + Answer```:
|
90 |
- https://huggingface.co/potsawee/t5-large-generation-race-QuestionAnswer
|
|
|
51 |
>>> selected_answer = options[np.argmax(prob)]
|
52 |
|
53 |
>>> print(prob)
|
54 |
+
[0.00145158, 0.00460851, 0.99049687, 0.00344302]
|
55 |
>>> print(selected_answer)
|
56 |
Joao Felix
|
57 |
```
|
58 |
|
59 |
+
where the function that prepare the input to the answering model is:
|
60 |
|
61 |
```python
|
62 |
def prepare_answering_input(
|
|
|
66 |
context, # str
|
67 |
max_seq_length=4096,
|
68 |
):
|
69 |
+
c_plus_q = context + ' ' + tokenizer.bos_token + ' ' + question
|
70 |
c_plus_q_4 = [c_plus_q] * len(options)
|
71 |
tokenized_examples = tokenizer(
|
72 |
c_plus_q_4, options,
|
|
|
84 |
return example_encoded
|
85 |
```
|
86 |
|
|
|
87 |
## Related Models
|
88 |
- Question/Answering Generation ```Context ---> Question + Answer```:
|
89 |
- https://huggingface.co/potsawee/t5-large-generation-race-QuestionAnswer
|