Download joint/example.py from Quenlla/columnist: direct link, hf CLI and curl.
- Browser
- Download file 910 Bytes
-
https://huggingface.co/Quenlla/columnist/resolve/main/joint/example.py
- Command line
-
hf download hf://Quenlla/columnist/joint/example.py
-
curl -L -o example.py https://huggingface.co/Quenlla/columnist/resolve/main/joint/example.py
910 Bytes
| """python example.py joint_plain.final.pt calibration_joint_plain.json chart.osu""" | |
| import json | |
| import sys | |
| import numpy as np | |
| import joint_infer | |
| from osu_to_arrays import osu_to_arrays | |
| ck, cal, osu = sys.argv[1:4] | |
| model = joint_infer.load(ck) | |
| arrays = osu_to_arrays(osu) | |
| if arrays is None: | |
| raise SystemExit("not a 4K mania chart with at least 64 rows") | |
| out = model.predict(*arrays) | |
| cal = json.load(open(cal)) | |
| stars = cal["linear"]["intercept"] + cal["linear"]["slope"] * out["difficulty"] | |
| print(f"difficulty score {out['difficulty']:.2f} (about {stars:.2f} stars; isotonic: {np.interp(out['difficulty'], cal['isotonic']['x'], cal['isotonic']['y']):.2f})") | |
| for t, p in sorted(zip(out["tasks"], out["tag_prob"]), key=lambda x: -x[1])[:8]: | |
| print(f" {t:32s} {p:.2f}") | |
| print("rows:", len(out["row_score"]), " hardest windows (512 rows each):", np.round(np.sort(out["window_difficulty"])[::-1][:3], 2)) | |