Spaces:
Build error
Build error
Download utils.py from puzogang808/rag: direct link, hf CLI and curl.
- Browser
- Download file 342 Bytes
-
https://huggingface.co/spaces/puzogang808/rag/resolve/main/utils.py
- Command line
-
hf download hf://spaces/puzogang808/rag/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/puzogang808/rag/resolve/main/utils.py
342 Bytes
| import config | |
| from transformers import AutoTokenizer | |
| from typing import List | |
| def align_features(dataset): | |
| def fix_authors(example): | |
| if not isinstance(example["authors"], list): | |
| return {"authors": [example["authors"]] if example["authors"] else []} | |
| return example | |
| return dataset.map(fix_authors) |