-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ef9091
commit 5f72b0d
Showing
25 changed files
with
978 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
from unitxt import add_to_catalog | ||
from unitxt.blocks import ( | ||
LoadHF, | ||
TaskCard, | ||
) | ||
from unitxt.collections_operators import Dictify, Wrap | ||
from unitxt.operators import Copy, Set | ||
from unitxt.test_utils.card import test_card | ||
|
||
for subset in [ | ||
"covidqa", | ||
"cuad", | ||
"delucionqa", | ||
"emanual", | ||
"expertqa", | ||
"finqa", | ||
"hagrid", | ||
"hotpotqa", | ||
"msmarco", | ||
"pubmedqa", | ||
"tatqa", | ||
"techqa", | ||
]: | ||
card = TaskCard( | ||
loader=LoadHF( | ||
path="rungalileo/ragbench", | ||
name=subset, | ||
), | ||
preprocess_steps=[ | ||
Copy(field="documents", to_field="contexts"), | ||
Copy(field="documents", to_field="contexts_ids"), | ||
Wrap(field="response", inside="list", to_field="reference_answers"), | ||
], | ||
task="tasks.rag.response_generation", | ||
templates={"default": "templates.rag.response_generation.please_respond_chat"}, | ||
) | ||
|
||
if subset == "covidqa": | ||
test_card( | ||
card, | ||
strict=True, | ||
metrics=["metrics.rouge"], | ||
demos_taken_from="test", | ||
) | ||
|
||
add_to_catalog( | ||
card, f"cards.rag.response_generation.ragbench.{subset}", overwrite=True | ||
) | ||
|
||
card = TaskCard( | ||
loader=LoadHF( | ||
path="rungalileo/ragbench", | ||
name=subset, | ||
), | ||
preprocess_steps=[ | ||
Set({"context_type": "documents"}), | ||
Wrap(field="documents", inside="list", process_every_value=True), | ||
Dictify( | ||
field="documents", | ||
to_field="context", | ||
with_keys=["body"], | ||
process_every_value=True, | ||
), | ||
Set({"context/*/title": "Document"}), | ||
Wrap(field="response", inside="list", to_field="answers"), | ||
], | ||
task="tasks.qa.with_context", | ||
templates="templates.qa.with_context.all", | ||
) | ||
|
||
if subset == "covidqa": | ||
test_card( | ||
card, | ||
strict=True, | ||
demos_taken_from="test", | ||
) | ||
|
||
add_to_catalog(card, f"cards.ragbench.{subset}", overwrite=True) |
30 changes: 30 additions & 0 deletions
30
src/unitxt/catalog/cards/rag/response_generation/ragbench/covidqa.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"__type__": "task_card", | ||
"loader": { | ||
"__type__": "load_hf", | ||
"path": "rungalileo/ragbench", | ||
"name": "covidqa" | ||
}, | ||
"preprocess_steps": [ | ||
{ | ||
"__type__": "copy", | ||
"field": "documents", | ||
"to_field": "contexts" | ||
}, | ||
{ | ||
"__type__": "copy", | ||
"field": "documents", | ||
"to_field": "contexts_ids" | ||
}, | ||
{ | ||
"__type__": "wrap", | ||
"field": "response", | ||
"inside": "list", | ||
"to_field": "reference_answers" | ||
} | ||
], | ||
"task": "tasks.rag.response_generation", | ||
"templates": { | ||
"default": "templates.rag.response_generation.please_respond_chat" | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/unitxt/catalog/cards/rag/response_generation/ragbench/cuad.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"__type__": "task_card", | ||
"loader": { | ||
"__type__": "load_hf", | ||
"path": "rungalileo/ragbench", | ||
"name": "cuad" | ||
}, | ||
"preprocess_steps": [ | ||
{ | ||
"__type__": "copy", | ||
"field": "documents", | ||
"to_field": "contexts" | ||
}, | ||
{ | ||
"__type__": "copy", | ||
"field": "documents", | ||
"to_field": "contexts_ids" | ||
}, | ||
{ | ||
"__type__": "wrap", | ||
"field": "response", | ||
"inside": "list", | ||
"to_field": "reference_answers" | ||
} | ||
], | ||
"task": "tasks.rag.response_generation", | ||
"templates": { | ||
"default": "templates.rag.response_generation.please_respond_chat" | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/unitxt/catalog/cards/rag/response_generation/ragbench/delucionqa.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"__type__": "task_card", | ||
"loader": { | ||
"__type__": "load_hf", | ||
"path": "rungalileo/ragbench", | ||
"name": "delucionqa" | ||
}, | ||
"preprocess_steps": [ | ||
{ | ||
"__type__": "copy", | ||
"field": "documents", | ||
"to_field": "contexts" | ||
}, | ||
{ | ||
"__type__": "copy", | ||
"field": "documents", | ||
"to_field": "contexts_ids" | ||
}, | ||
{ | ||
"__type__": "wrap", | ||
"field": "response", | ||
"inside": "list", | ||
"to_field": "reference_answers" | ||
} | ||
], | ||
"task": "tasks.rag.response_generation", | ||
"templates": { | ||
"default": "templates.rag.response_generation.please_respond_chat" | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/unitxt/catalog/cards/rag/response_generation/ragbench/emanual.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"__type__": "task_card", | ||
"loader": { | ||
"__type__": "load_hf", | ||
"path": "rungalileo/ragbench", | ||
"name": "emanual" | ||
}, | ||
"preprocess_steps": [ | ||
{ | ||
"__type__": "copy", | ||
"field": "documents", | ||
"to_field": "contexts" | ||
}, | ||
{ | ||
"__type__": "copy", | ||
"field": "documents", | ||
"to_field": "contexts_ids" | ||
}, | ||
{ | ||
"__type__": "wrap", | ||
"field": "response", | ||
"inside": "list", | ||
"to_field": "reference_answers" | ||
} | ||
], | ||
"task": "tasks.rag.response_generation", | ||
"templates": { | ||
"default": "templates.rag.response_generation.please_respond_chat" | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/unitxt/catalog/cards/rag/response_generation/ragbench/expertqa.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"__type__": "task_card", | ||
"loader": { | ||
"__type__": "load_hf", | ||
"path": "rungalileo/ragbench", | ||
"name": "expertqa" | ||
}, | ||
"preprocess_steps": [ | ||
{ | ||
"__type__": "copy", | ||
"field": "documents", | ||
"to_field": "contexts" | ||
}, | ||
{ | ||
"__type__": "copy", | ||
"field": "documents", | ||
"to_field": "contexts_ids" | ||
}, | ||
{ | ||
"__type__": "wrap", | ||
"field": "response", | ||
"inside": "list", | ||
"to_field": "reference_answers" | ||
} | ||
], | ||
"task": "tasks.rag.response_generation", | ||
"templates": { | ||
"default": "templates.rag.response_generation.please_respond_chat" | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/unitxt/catalog/cards/rag/response_generation/ragbench/finqa.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"__type__": "task_card", | ||
"loader": { | ||
"__type__": "load_hf", | ||
"path": "rungalileo/ragbench", | ||
"name": "finqa" | ||
}, | ||
"preprocess_steps": [ | ||
{ | ||
"__type__": "copy", | ||
"field": "documents", | ||
"to_field": "contexts" | ||
}, | ||
{ | ||
"__type__": "copy", | ||
"field": "documents", | ||
"to_field": "contexts_ids" | ||
}, | ||
{ | ||
"__type__": "wrap", | ||
"field": "response", | ||
"inside": "list", | ||
"to_field": "reference_answers" | ||
} | ||
], | ||
"task": "tasks.rag.response_generation", | ||
"templates": { | ||
"default": "templates.rag.response_generation.please_respond_chat" | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/unitxt/catalog/cards/rag/response_generation/ragbench/hagrid.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"__type__": "task_card", | ||
"loader": { | ||
"__type__": "load_hf", | ||
"path": "rungalileo/ragbench", | ||
"name": "hagrid" | ||
}, | ||
"preprocess_steps": [ | ||
{ | ||
"__type__": "copy", | ||
"field": "documents", | ||
"to_field": "contexts" | ||
}, | ||
{ | ||
"__type__": "copy", | ||
"field": "documents", | ||
"to_field": "contexts_ids" | ||
}, | ||
{ | ||
"__type__": "wrap", | ||
"field": "response", | ||
"inside": "list", | ||
"to_field": "reference_answers" | ||
} | ||
], | ||
"task": "tasks.rag.response_generation", | ||
"templates": { | ||
"default": "templates.rag.response_generation.please_respond_chat" | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/unitxt/catalog/cards/rag/response_generation/ragbench/hotpotqa.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"__type__": "task_card", | ||
"loader": { | ||
"__type__": "load_hf", | ||
"path": "rungalileo/ragbench", | ||
"name": "hotpotqa" | ||
}, | ||
"preprocess_steps": [ | ||
{ | ||
"__type__": "copy", | ||
"field": "documents", | ||
"to_field": "contexts" | ||
}, | ||
{ | ||
"__type__": "copy", | ||
"field": "documents", | ||
"to_field": "contexts_ids" | ||
}, | ||
{ | ||
"__type__": "wrap", | ||
"field": "response", | ||
"inside": "list", | ||
"to_field": "reference_answers" | ||
} | ||
], | ||
"task": "tasks.rag.response_generation", | ||
"templates": { | ||
"default": "templates.rag.response_generation.please_respond_chat" | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/unitxt/catalog/cards/rag/response_generation/ragbench/msmarco.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"__type__": "task_card", | ||
"loader": { | ||
"__type__": "load_hf", | ||
"path": "rungalileo/ragbench", | ||
"name": "msmarco" | ||
}, | ||
"preprocess_steps": [ | ||
{ | ||
"__type__": "copy", | ||
"field": "documents", | ||
"to_field": "contexts" | ||
}, | ||
{ | ||
"__type__": "copy", | ||
"field": "documents", | ||
"to_field": "contexts_ids" | ||
}, | ||
{ | ||
"__type__": "wrap", | ||
"field": "response", | ||
"inside": "list", | ||
"to_field": "reference_answers" | ||
} | ||
], | ||
"task": "tasks.rag.response_generation", | ||
"templates": { | ||
"default": "templates.rag.response_generation.please_respond_chat" | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/unitxt/catalog/cards/rag/response_generation/ragbench/pubmedqa.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"__type__": "task_card", | ||
"loader": { | ||
"__type__": "load_hf", | ||
"path": "rungalileo/ragbench", | ||
"name": "pubmedqa" | ||
}, | ||
"preprocess_steps": [ | ||
{ | ||
"__type__": "copy", | ||
"field": "documents", | ||
"to_field": "contexts" | ||
}, | ||
{ | ||
"__type__": "copy", | ||
"field": "documents", | ||
"to_field": "contexts_ids" | ||
}, | ||
{ | ||
"__type__": "wrap", | ||
"field": "response", | ||
"inside": "list", | ||
"to_field": "reference_answers" | ||
} | ||
], | ||
"task": "tasks.rag.response_generation", | ||
"templates": { | ||
"default": "templates.rag.response_generation.please_respond_chat" | ||
} | ||
} |
Oops, something went wrong.