Quick parity/export guide
-
Train locally
- Run your training as usual. It should produce:
- models/recurrent_model.pth
- models/best_params.json
- Run your training as usual. It should produce:
-
Export NumPy weights
-
Requires torch CPU in a Python 3.10–3.12 env.
-
Command: python3 export_npz_from_pth.py --pth models/recurrent_model.pth --out models
-
This generates models/recurrent_model_np.npz and bumps its mtime to be newer than the .pth.
-
-
Parity check (optional, recommended)
-
Command: python3 compare_backends.py
-
Expect near-zero diffs for base_metabolism_kcal and W_adj_pred.
-
-
Deploy on Render
-
Upload these three files to /app/models/ in the container:
- recurrent_model_pth
- recurrent_model_np.npz
- best_params.json
-
The API will prefer NumPy if the .npz exists and is as new as (or newer than) the .pth.
-