Download tools/sampling.py from tiendung/ZIN02: direct link, hf CLI and curl.
- Browser
- Download file 303 Bytes
-
https://huggingface.co/datasets/tiendung/ZIN02/resolve/main/tools/sampling.py
- Command line
-
hf download hf://datasets/tiendung/ZIN02/tools/sampling.py
-
curl -L -o sampling.py https://huggingface.co/datasets/tiendung/ZIN02/resolve/main/tools/sampling.py
303 Bytes
| import json, sys, random, lzma | |
| input_file = sys.argv[1] | |
| max_idx = int(sys.argv[2]) | |
| idx = random.randint(0, max_idx) | |
| with lzma.open(input_file, "rt") as fin: | |
| for i, line in enumerate(fin): | |
| if i == idx: | |
| a = json.loads(line)["data"] | |
| for x in a: print(x, "\n\n - - -\n\n") | |
| break | |