Skip to content

Instantly share code, notes, and snippets.

@lgray
Created November 19, 2021 17:47
Show Gist options
  • Select an option

  • Save lgray/6ca8febbfab20d4703f87991b0aee8d7 to your computer and use it in GitHub Desktop.

Select an option

Save lgray/6ca8febbfab20d4703f87991b0aee8d7 to your computer and use it in GitHub Desktop.
import torch
from torch_cmspepr.dataset import TauDataset
import json
from tqdm import tqdm
dataset = TauDataset("/mnt/d/mldata/hgcalml/npzs_all")
out_list = []
for i, data in tqdm(enumerate(dataset[:1000])):
out_list.append({
"features__0": { "content": data.x.flatten().tolist(), "shape": list(data.x.size()) },
"batch__0": { "content": torch.zeros((data.x.size()[0])).tolist(), "shape": [data.x.size()[0]] },
})
with open("perfdata.json", "w") as fout:
json.dump({"data": out_list}, fout)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment