How gridfm/gridfm-graphkit works
gridfm-graphkit is a power-grid graph foundation-model library for training, fine-tuning, evaluating, predicting, and serving reconstruction requests. The principal workflow is CLI configuration → graph dataset and data module → task/model execution → losses and logged or saved results. Separate task modules cover power flow, optimal power flow, state estimation, and reconstruction. The vLLM integration provides an additional serving path. Edges below are limited to README statements and visible source references; several domain-specific links remain unshown because their implementation was not sampled.
Main entry points: cli.py CLI workflows · hetero_powergrid_datamodule.py Data module · io_processor.py PF request processor · param_handler.py Component factories
Components 29
User interface
- CLI workflows
gridfm_graphkit/cli.py - Config migration
gridfm_graphkit/io/config_version.py - Component factories
gridfm_graphkit/io/param_handler.py - Registries
gridfm_graphkit/io/registries.py
Graph data
- Data module
gridfm_graphkit/datasets/hetero_powergrid_datamodule.py - Power-grid dataset
gridfm_graphkit/datasets/powergrid_hetero_dataset.py - Graph construction
gridfm_graphkit/datasets/graph_builder.py - Feature schema
gridfm_graphkit/datasets/globals.py - Normalization
gridfm_graphkit/datasets/normalizers.py - Positional statistics
gridfm_graphkit/datasets/posenc_stats.py
Model components
- Heterogeneous GNN
gridfm_graphkit/models/gnn_heterogeneous_gns.py - GRIT transformer
gridfm_graphkit/models/grit_transformer.py - GRIT layer
gridfm_graphkit/models/grit_layer.py - Physics decoders
gridfm_graphkit/models/utils.py
Tasks and training
- Task base
gridfm_graphkit/tasks/base_task.py - Reconstruction task
gridfm_graphkit/tasks/reconstruction_tasks.py - Power flow task
gridfm_graphkit/tasks/pf_task.py - Optimal flow task
gridfm_graphkit/tasks/opf_task.py - State estimation
gridfm_graphkit/tasks/se_task.py - AC/DC baselines
gridfm_graphkit/tasks/pf_ac_dc_baseline.py - OPF baselines
gridfm_graphkit/tasks/opf_ac_dc_baseline.py - Loss functions
gridfm_graphkit/training/loss.py - Training callbacks
gridfm_graphkit/training/callbacks.py
Inference serving
- vLLM model
gridfm_graphkit/vllm/model.py - Inference bundle
gridfm_graphkit/vllm/config.py - Graph codec
gridfm_graphkit/vllm/graph_codec.py - PF request processor
gridfm_graphkit/vllm/plugins/pf_reconstruction/io_processor.py
Other components
- User
- vLLM runtime
Connections 29
- User → CLI workflows: invokes
README.md - CLI workflows → Config migration: resolves config
gridfm_graphkit/cli.py - CLI workflows → Data module: sets up data
gridfm_graphkit/cli.py - CLI workflows → Component factories: loads task
gridfm_graphkit/cli.py - CLI workflows → Training callbacks: configures callbacks
gridfm_graphkit/cli.py - Data module → Power-grid dataset: creates dataset
gridfm_graphkit/datasets/hetero_powergrid_datamodule.py - Data module → Normalization: fits normalizers
gridfm_graphkit/datasets/hetero_powergrid_datamodule.py - Data module → Positional statistics: uses statistics
gridfm_graphkit/datasets/hetero_powergrid_datamodule.py - Power-grid dataset → Graph construction: builds graphs
gridfm_graphkit/datasets/powergrid_hetero_dataset.py - Power-grid dataset → Normalization: normalizes data
gridfm_graphkit/datasets/powergrid_hetero_dataset.py - Component factories → Registries: creates components
gridfm_graphkit/io/param_handler.py - Component factories → Loss functions: creates losses
gridfm_graphkit/io/param_handler.py - Reconstruction task → Component factories: loads model and loss
gridfm_graphkit/tasks/reconstruction_tasks.py - Reconstruction task → Task base: extends
gridfm_graphkit/tasks/reconstruction_tasks.py - GRIT transformer → GRIT layer: uses layer
gridfm_graphkit/models/grit_transformer.py - Heterogeneous GNN → Feature schema: uses schema
gridfm_graphkit/models/gnn_heterogeneous_gns.py - GRIT transformer → Feature schema: uses schema
gridfm_graphkit/models/grit_transformer.py - Power flow task → Feature schema: uses schema
gridfm_graphkit/tasks/pf_task.py - Optimal flow task → Feature schema: uses schema
gridfm_graphkit/tasks/opf_task.py - Power flow task → Physics decoders: uses decoders
gridfm_graphkit/tasks/pf_task.py - Optimal flow task → Physics decoders: uses decoders
gridfm_graphkit/tasks/opf_task.py - Power flow task → Loss functions: computes losses
- Optimal flow task → Loss functions: computes losses
- vLLM model → Inference bundle: loads config
gridfm_graphkit/vllm/model.py - vLLM model → Graph codec: uses codec
gridfm_graphkit/vllm/model.py - PF request processor → Inference bundle: builds bundle
gridfm_graphkit/vllm/plugins/pf_reconstruction/io_processor.py - PF request processor → Graph construction: constructs graphs
gridfm_graphkit/vllm/plugins/pf_reconstruction/io_processor.py - PF request processor → Graph codec: encodes graphs
gridfm_graphkit/vllm/plugins/pf_reconstruction/io_processor.py - vLLM runtime → PF request processor: dispatches requests