π GovtΒΆ
cards.rag.mtrag.documents.govt
TaskCard(
loader=LoadCSV(
files={
"test": "https://github.com/IBM/mt-rag-benchmark/raw/refs/heads/main/corpora/govt.jsonl.zip",
},
compression="zip",
file_type="json",
lines=True,
data_classification_policy=[
"public",
],
),
preprocess_steps=[
Wrap(
field="text",
inside="list",
to_field="passages",
),
],
task="tasks.rag.corpora",
templates={
"empty": InputOutputTemplate(
input_format="",
output_format="",
),
},
)
[source]from unitxt.collections_operators import Wrap
from unitxt.loaders import LoadCSV
from unitxt.templates import InputOutputTemplate
Explanation about TaskCardΒΆ
TaskCard delineates the phases in transforming the source dataset into model input, and specifies the metrics for evaluation of model output.
- Args:
- loader:
specifies the source address and the loading operator that can access that source and transform it into a unitxt multistream.
- preprocess_steps:
list of unitxt operators to process the data source into model input.
- task:
specifies the fields (of the already (pre)processed instance) making the inputs, the fields making the outputs, and the metrics to be used for evaluating the model output.
- templates:
format strings to be applied on the input fields (specified by the task) and the output fields. The template also carries the instructions and the list of postprocessing steps, to be applied to the model output.
Explanation about InputOutputTemplateΒΆ
Generate field βsourceβ from fields designated as input, and fields βtargetβ and βreferencesβ from fields designated as output, of the processed instance.
Args specify the formatting strings with which to glue together the input and reference fields of the processed instance into one string (βsourceβ and βtargetβ), and into a list of strings (βreferencesβ).
Explanation about LoadCSVΒΆ
Loads data from CSV files.
Supports streaming and can handle large files by loading them in chunks.
- Args:
files (Dict[str, str]): A dictionary mapping names to file paths. chunksize : Size of the chunks to load at a time. loader_limit: Optional integer to specify a limit on the number of records to load. streaming: Bool indicating if streaming should be used. sep: String specifying the separator used in the CSV files.
- Example:
Loading csv
load_csv = LoadCSV(files={'train': 'path/to/train.csv'}, chunksize=100)
References: tasks.rag.corpora
Read more about catalog usage here.