An AI copilot for graph data and models (Under active development).
Project description
pygfm
A unified Python toolkit for Graph Foundation Models (GFM) research, integrating 19 baseline methods under a single package with shared utilities, standardized interfaces, and reproducible experiment pipelines.
Developed by Beihang University, School of Computer Science and Engineering, ACT Lab, MAGIC GROUP.
Installation
pip install python-gfm
Install with optional dependencies:
pip install python-gfm[torch] # PyTorch + PyG
pip install python-gfm[dev] # pytest + ruff
For development (full checkout with experiment scripts):
git clone <repo-url> && cd pythongfm
pip install -e ".[torch,dev]"
Quick Start
import pygfm
print(pygfm.__version__)
Package Structure
pygfm/
├── baseline_models/ # 19 GFM baseline implementations
├── public/ # Shared utilities, losses, backbone encoders
│ ├── backbone_models/
│ ├── utils/
│ ├── cli/
│ └── model_bases.py
├── private/ # Internal modules (core encoders, data generation)
└── cli/ # Console entrypoints
Supported Baselines
| Category | Baselines |
|---|---|
| Prompt-based GFM | MDGPT, SAMGPT, MDGFM, GraphPrompt, HGPrompt, MultiGPrompt, GCoT |
| Structure-aware | SA2GFM, Bridge, GraphKeeper, GraphMore, Graver, BIM-GFM |
| LLM-integrated | GraphGPT, GraphText, LLaGA, OneForAll |
| Retrieval-augmented | RAG-GFM |
| Classic | Classic GNN |
Running Experiments
Each baseline has its own experiment scripts under scripts/<baseline>/. Run from the repository root:
# Pre-training
python scripts/mdgpt/pretrain.py
# Downstream fine-tuning
python scripts/sa2gfm/downstream.py
# Full pipeline with config
python scripts/gcot/pretrain.py
python scripts/gcot/finetune.py
python scripts/gcot/finetune_graph.py
Console Commands
After installation, the following CLI commands are available:
| Command | Description |
|---|---|
gfm-sa2gfm-pretrain |
SA2GFM contrastive pre-training (-c YAML) |
gfm-sa2gfm-downstream |
SA2GFM MoE downstream fine-tuning |
Baseline Documentation
Detailed instructions for each baseline:
| Baseline | Docs |
|---|---|
| MDGPT | [scripts/mdgpt/README.md](scripts/mdgpt/README.md) |
| SA2GFM | [scripts/sa2gfm/README.md](scripts/sa2gfm/README.md) |
| MultiGPrompt | [scripts/multigprompt/README.md](scripts/multigprompt/README.md) |
| LLaGA | [scripts/llaga/README.md](scripts/llaga/README.md) |
| GraphText | [scripts/graphtext/README.md](scripts/graphtext/README.md) |
| GraphGPT | [scripts/graphgpt/README.md](scripts/graphgpt/README.md) |
| OneForAll | [scripts/oneforall/README.md](scripts/oneforall/README.md) |
| MDGFM | [scripts/mdgfm/README.md](scripts/mdgfm/README.md) |
| SAMGPT | [scripts/samgpt/README.md](scripts/samgpt/README.md) |
| GCoT | [scripts/gcot/README.md](scripts/gcot/README.md) |
| HGPrompt | [scripts/hgprompt/README.md](scripts/hgprompt/README.md) |
| GraphPrompt | [scripts/graphprompt/README.md](scripts/graphprompt/README.md) |
| Graver | [scripts/graver/README.md](scripts/graver/README.md) |
| GraphMore | [scripts/graphmore/README.md](scripts/graphmore/README.md) |
| Bridge | [scripts/bridge/README.md](scripts/bridge/README.md) |
| GraphKeeper | [scripts/graphkeeper/README.md](scripts/graphkeeper/README.md) |
| RAG-GFM | [scripts/rag_gfm/README.md](scripts/rag_gfm/README.md) |
Configuration
Experiment configs are YAML files located at scripts/<baseline>/configs/. Pass them via -c flag or as positional arguments depending on the baseline.
Important: Do not commit API keys. For baselines that require LLM API access (e.g., GraphText), copy the example config and fill in your keys locally:
cp scripts/graphtext/config/user/env.yaml.example scripts/graphtext/config/user/env.yaml
License
This project is licensed under the Apache License 2.0.
Team
MAGIC GROUP -- Beihang University, School of Computer Science and Engineering, ACT Lab.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_gfm-0.1.2.tar.gz.
File metadata
- Download URL: python_gfm-0.1.2.tar.gz
- Upload date:
- Size: 3.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3027df223c0cc9d19f61b4fceb9985d289d541f765eeb8446bc43eca9e53c92
|
|
| MD5 |
9cfb5b974ea9a08903cd34acdcd1b174
|
|
| BLAKE2b-256 |
c41a730f70c4dbd11251ae4b4abaedae7b1d87ea56500f664cd2b91ee513a6b1
|
File details
Details for the file python_gfm-0.1.2-py3-none-any.whl.
File metadata
- Download URL: python_gfm-0.1.2-py3-none-any.whl
- Upload date:
- Size: 3.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1937d0febed6a49f0a5a94233d21ddbc04c0576309b9f2b4c50042ca4d46d4e4
|
|
| MD5 |
fe006bf6ca8f9baaaabb99e2e95fd4ad
|
|
| BLAKE2b-256 |
f0348050dcbabcebb993829f5520f133b28b0d85631d8e912056dc7faf034703
|