Skip to main content

An AI copilot for graph data and models (Under active development).

Project description

pygfm

PyPI version Python License

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_gfm-0.1.4.tar.gz (552.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_gfm-0.1.4-py3-none-any.whl (752.2 kB view details)

Uploaded Python 3

File details

Details for the file python_gfm-0.1.4.tar.gz.

File metadata

  • Download URL: python_gfm-0.1.4.tar.gz
  • Upload date:
  • Size: 552.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for python_gfm-0.1.4.tar.gz
Algorithm Hash digest
SHA256 9cdca0d09f51d5ac6c9af9d98a7ea8d777cc79f6525dcee56f0f4643b1babcc6
MD5 9a93b6d77d027d1a39806b8262ee620f
BLAKE2b-256 57e74eda336fe88d0905a30152f23a4752befd39fe2e26b2646138cab2571c08

See more details on using hashes here.

File details

Details for the file python_gfm-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: python_gfm-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 752.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for python_gfm-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cef900cc9fb543b24436926057122ca809f60e65ede8a1ac7893aee089faefe7
MD5 c1361881d46f767fbf1a1b159b0591fc
BLAKE2b-256 8fc4fcdb7f3e2ca0114269e5091a2e113d0edaeaf43164eea6e40c6a55c13aac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page