Download convert_ds.py from p4llms/p4dataset: direct link, hf CLI and curl.
- Browser
- Download file 348 Bytes
-
https://huggingface.co/datasets/p4llms/p4dataset/resolve/main/convert_ds.py
- Command line
-
hf download hf://datasets/p4llms/p4dataset/convert_ds.py
-
curl -L -o convert_ds.py https://huggingface.co/datasets/p4llms/p4dataset/resolve/main/convert_ds.py
348 Bytes
| #!/usr/bin/env python3 | |
| import json | |
| import sys | |
| def main(): | |
| with open(sys.argv[1], 'r') as fin: | |
| data = json.load(fin) | |
| lines = [] | |
| for entry in data: | |
| line = json.dumps(entry) | |
| lines.append(line) | |
| with open(sys.argv[2], 'w') as fout: | |
| fout.write("\n".join(lines)) | |
| if __name__ == "__main__": | |
| main() | |