Download task.py from unitxt/data: direct link, hf CLI and curl.
- Browser
- Download file 567 Bytes
-
https://huggingface.co/datasets/unitxt/data/resolve/147bcf91b64d950b6046751ccc47697c1d0e9dad/task.py
- Command line
-
hf download hf://datasets/unitxt/data@147bcf91b64d950b6046751ccc47697c1d0e9dad/task.py
-
curl -L -o task.py https://huggingface.co/datasets/unitxt/data/resolve/147bcf91b64d950b6046751ccc47697c1d0e9dad/task.py
567 Bytes
| from .operator import StreamInstanceOperator | |
| from typing import Dict, List, Any | |
| class Tasker: | |
| pass | |
| class FormTask(Tasker, StreamInstanceOperator): | |
| inputs: List[str] | |
| outputs: List[str] | |
| metrics: List[str] | |
| def process(self, instance: Dict[str, Any], stream_name: str = None) -> Dict[str, Any]: | |
| inputs = {key: instance[key] for key in self.inputs} | |
| outputs = {key: instance[key] for key in self.outputs} | |
| return { | |
| "inputs": inputs, | |
| "outputs": outputs, | |
| "metrics": self.metrics, | |
| } | |