Update README.md
Browse files
README.md
CHANGED
@@ -491,6 +491,8 @@ print(outputs[0].outputs[0].text)
|
|
491 |
|
492 |
This model can also generate questions and answers based on a piece of text. This can be useful for pre-indexing a database or fine-tuning IR models that will then be used for RAG.
|
493 |
|
|
|
|
|
494 |
<details>
|
495 |
<summary>Prompt style</summary>
|
496 |
|
@@ -499,6 +501,9 @@ This model can also generate questions and answers based on a piece of text. Thi
|
|
499 |
<<Q&A Generation Context>>
|
500 |
Japan's current account surplus in July was 3.2 trillion yen, the highest monthly surplus on record for the month of July.
|
501 |
However, the surplus continues to be driven by the primary income balance, which recorded a surplus of 4.4 trillion yen in July, the highest monthly figure on record.
|
|
|
|
|
|
|
502 |
```
|
503 |
|
504 |
### Output:
|
@@ -524,11 +529,14 @@ sampling_params = SamplingParams(temperature=0.2, top_p=0.95, max_tokens=128)
|
|
524 |
|
525 |
context = "Finance Minister Shunichi Suzuki appointed Kenji Suwazono, former Director-General of the Customs and Tariff Bureau at the Ministry of Finance, as the new Executive Director of the Bank of Japan effective the 10th. Suwazono succeeds Masaaki Kaizuka, whose term ended on the 9th, and his term will last for four years.",
|
526 |
|
527 |
-
def create_qagen_prompt(context):
|
528 |
|
529 |
str_inputs = f"""<<Q&A Generation Context>>
|
530 |
{context}"""
|
531 |
|
|
|
|
|
|
|
532 |
chat = [
|
533 |
{"role": "user", "content": str_inputs},
|
534 |
]
|
|
|
491 |
|
492 |
This model can also generate questions and answers based on a piece of text. This can be useful for pre-indexing a database or fine-tuning IR models that will then be used for RAG.
|
493 |
|
494 |
+
To define the language of the Q&A, you can optionally include a `<<Q&A Language>>` control code after the text
|
495 |
+
|
496 |
<details>
|
497 |
<summary>Prompt style</summary>
|
498 |
|
|
|
501 |
<<Q&A Generation Context>>
|
502 |
Japan's current account surplus in July was 3.2 trillion yen, the highest monthly surplus on record for the month of July.
|
503 |
However, the surplus continues to be driven by the primary income balance, which recorded a surplus of 4.4 trillion yen in July, the highest monthly figure on record.
|
504 |
+
|
505 |
+
<<Q&A Language>>
|
506 |
+
English
|
507 |
```
|
508 |
|
509 |
### Output:
|
|
|
529 |
|
530 |
context = "Finance Minister Shunichi Suzuki appointed Kenji Suwazono, former Director-General of the Customs and Tariff Bureau at the Ministry of Finance, as the new Executive Director of the Bank of Japan effective the 10th. Suwazono succeeds Masaaki Kaizuka, whose term ended on the 9th, and his term will last for four years.",
|
531 |
|
532 |
+
def create_qagen_prompt(context, language_name = None):
|
533 |
|
534 |
str_inputs = f"""<<Q&A Generation Context>>
|
535 |
{context}"""
|
536 |
|
537 |
+
if language_name is not None:
|
538 |
+
str_inputs += "\n\n<<Q&A Language>>\n{language_name}"
|
539 |
+
|
540 |
chat = [
|
541 |
{"role": "user", "content": str_inputs},
|
542 |
]
|