Download validate.py from Delower/liver-gat-deployment: direct link, hf CLI and curl.
- Browser
- Download file 955 Bytes
-
https://huggingface.co/Delower/liver-gat-deployment/resolve/main/validate.py
- Command line
-
hf download hf://Delower/liver-gat-deployment/validate.py
-
curl -L -o validate.py https://huggingface.co/Delower/liver-gat-deployment/resolve/main/validate.py
955 Bytes
| # validate.py — loads the shipped GAT deployment weights and reproduces | |
| # the model's predictions on examples.json (8 DPP-4 leads screened with | |
| # this exact model; expected probabilities stored alongside the SMILES). | |
| # Exits non-zero if any reproduced probability deviates by > 2e-3. | |
| import json, os, sys | |
| HERE = os.path.dirname(os.path.abspath(__file__)) | |
| sys.path.insert(0, HERE) | |
| from infer import predict | |
| examples = json.load(open(os.path.join(HERE, "examples.json"))) | |
| worst = 0.0 | |
| for ex in examples: | |
| got = predict(ex["smiles"]) | |
| exp = ex["expected_Liver_GAT_deployment_prob"] | |
| assert got is not None, f"unparseable example: {ex['lead_id']}" | |
| dev = abs(got - exp) | |
| worst = max(worst, dev) | |
| print(f"{ex['lead_id']:>8} expected {exp:.6f} got {got:.6f} dev {dev:.2e}") | |
| assert dev <= 2e-3, f"deviation too large for {ex['lead_id']}: {dev}" | |
| print(f"VALIDATION PASSED — max deviation {worst:.2e} over {len(examples)} examples") | |