FEAT: ChargE3Net Fine-Tuning Pipeline on LeMatRho#8
Open
speckhard wants to merge 5 commits intoLeMaterial:mainfrom
Open
FEAT: ChargE3Net Fine-Tuning Pipeline on LeMatRho#8speckhard wants to merge 5 commits intoLeMaterial:mainfrom
speckhard wants to merge 5 commits intoLeMaterial:mainfrom
Conversation
- Add wandb integration with --wandb-project/--wandb-entity/--no-wandb flags - Add compute_rmse() and compute_nrmse() validation metrics - Log per-step train loss and per-epoch train/val metrics to W&B - Load WANDB_API_KEY from .env via python-dotenv - Add submit_charge3net.sh for Jean Zay A100 GPU jobs - Add .gitignore (excludes .env, checkpoints, wandb, etc.)
- save_checkpoint now includes global_step - load_checkpoint restores model, optimizer, scheduler, epoch, best_nmape, global_step - SLURM script auto-detects latest.pt and passes --resume-from
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat/charge3net— ChargE3Net Fine-Tuning PipelineOverview
Adds a complete PyTorch training pipeline to fine-tune ChargE3Net ("Higher-Order Equivariant Neural Networks for Charge Density Prediction in Materials", Koker et al., npj Computational Materials 2024) on LeMatRho charge density data stored in Parquet format. The model is initialized from a pre-trained Materials Project checkpoint (1.9M parameters) and fine-tuned on 65,239 materials with 10x10x10 charge density grids.
New Files
data.pyase.Atoms+ density grids, and builds charge3net-compatible graph dicts viaKdTreeGraphConstructor. Only a lightweight index (~2 MB) is held in memory; rows are read on-the-fly.model.pyE3DensityModel. Handles instantiation with MP checkpoint hyperparameters and loading from 3 checkpoint formats (legacy PyTorch Lightning, new charge3net, raw state_dict).train.pysubmit_charge3net.shlatest.ptif present..gitignore.env,.venv/,__pycache__/,checkpoints/,wandb/.Modified Files
pyproject.tomle3nn,scipy,lz4,pyarrow,pandas,wandb,python-dotenvVerification Tests
1. Smoke test (
--smoke-test): Loads the pre-trained MP checkpoint, runs a single forward pass on one batch, and verifies output shape and loss computation. Confirms the data pipeline produces tensors compatible with the model.2. Single-batch overfit test (
--overfit-single-batch): Fetches one batch, trains on it repeatedly for N epochs without validation. Proves the model can learn from this data pipeline — L1 dropped from 34.2 to 7.7 (77% reduction) over 150 epochs on CPU without pre-trained weights.3. Full training run (Jean Zay A100 GPU): Fine-tuning from the MP checkpoint on 61,978 training samples, validating on 3,261 samples. Results after 8 epochs:
Both train and val L1 are monotonically decreasing. Training is ongoing (50 epochs target, ~2h/epoch on A100).
Git Log
Pre-trained Weights
The Materials Project checkpoint (
charge3net_mp.pt, 23 MB, 1.9M params) is checked into the AIforGreatGood/charge3net repo undermodels/. It was trained for 245 epochs / 407,868 steps on Materials Project charge densities. We cloned the repo and used the checkpoint directly — no separate download required.External Dependency
Requires AIforGreatGood/charge3net cloned as a sibling directory (for
E3DensityModel,KdTreeGraphConstructor,collate_list_of_dicts,PowerDecayScheduler).