File size: 376 Bytes
bd4d522 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import json
import random
with open(
"/mnt/petrelfs/zhuchenglin/LLaVA/playground/data/llava_v1_5_mix665k.json"
) as f:
data = json.load(f)
selected_data = random.sample(data, 200000)
# 将选择的元素写入新的JSON文件
with open(
"/mnt/petrelfs/zhuchenglin/LLaVA/playground/data/llava_v1_5_mix200k.json",
"w",
) as f:
json.dump(selected_data, f)
|