Download src/validate_t2_graybox_closure.py from HaomingLuo/AgentFEM-Material-Loading-Memory: direct link, hf CLI and curl.
- Browser
- Download file 1.37 kB
-
https://huggingface.co/datasets/HaomingLuo/AgentFEM-Material-Loading-Memory/resolve/main/src/validate_t2_graybox_closure.py
- Command line
-
hf download hf://datasets/HaomingLuo/AgentFEM-Material-Loading-Memory/src/validate_t2_graybox_closure.py
-
curl -L -o validate_t2_graybox_closure.py https://huggingface.co/datasets/HaomingLuo/AgentFEM-Material-Loading-Memory/resolve/main/src/validate_t2_graybox_closure.py
1.37 kB
| """Promotion gates for the out-of-template incomplete-physics closure.""" | |
| import json | |
| from pathlib import Path | |
| from src.generate_t2_graybox_closure import MATERIAL, closure_design, material, solve | |
| from src.validate_t2_graybox import ( | |
| load_model, | |
| structural_gate, | |
| time_discretization_gate, | |
| ) | |
| ROOT = Path(__file__).resolve().parents[1] | |
| MODEL_PATH = ROOT / "models" / "t2_graybox_closure_v1" / "denrm.pt" | |
| ARTIFACT_DIR = ROOT / "artifacts" / "t2_graybox_closure_v1" | |
| OUTPUT = ARTIFACT_DIR / "deployment_validation.json" | |
| def main() -> None: | |
| model = load_model(MODEL_PATH) | |
| ARTIFACT_DIR.mkdir(parents=True, exist_ok=True) | |
| result = { | |
| "scope": ( | |
| "reference has three memories and tabulated hardening; deployed DENRM " | |
| "has two memories and no access to the reference equations" | |
| ), | |
| "time_discretization": time_discretization_gate( | |
| model, | |
| rows=closure_design(4), | |
| solve_function=solve, | |
| material=MATERIAL, | |
| ), | |
| "structure": structural_gate( | |
| model, | |
| material=MATERIAL, | |
| native_law_factory=material, | |
| artifact_dir=ARTIFACT_DIR, | |
| ), | |
| } | |
| OUTPUT.write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8") | |
| print(json.dumps(result, indent=2)) | |
| if __name__ == "__main__": | |
| main() | |