File size: 368 Bytes
42aa4d6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from pathlib import Path
import pickle
import json

p = Path("training/artifacts/hierarchy/hierarchy_embed.pkl")

with open(p, "rb") as f:
    hierarchy = pickle.load(f)

hierarchy_json = {k: v.astype(int).tolist() for k, v in hierarchy.items()}

with open("training/artifacts/hierarchy/hierarchy_embed.json", "w") as f:
    json.dump(hierarchy_json, f)

print("done")