Skip to content

Commit 853168f

Browse files
authored
Update preset (#3516)
1 parent af147d1 commit 853168f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fastchat/serve/vision/create_vqa_examples_json.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@
2828
for dataset_name in dataset_prop.keys():
2929
with open(f"{args.output_dir}/{dataset_name}/data.json") as f:
3030
data = json.load(f)
31-
dataset_json.extend(np.random.choice(data, dataset_prop[dataset_name]))
31+
dataset_json.extend(
32+
np.random.choice(
33+
data, min(dataset_prop[dataset_name], len(data)), replace=False
34+
)
35+
)
3236

3337
with open(f"{args.output_dir}/metadata_sampled.json", "w") as f:
3438
json.dump(dataset_json, f, indent=4)

0 commit comments

Comments
 (0)