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.8.tar.gz (18.9 MB 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.8-py3-none-any.whl (19.1 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_gfm-0.1.8.tar.gz
  • Upload date:
  • Size: 18.9 MB
  • 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.8.tar.gz
Algorithm Hash digest
SHA256 12b6482a9296d070a6451df517e605e4a1aa97c8f4a37ce48c0e7fec5d61b6ab
MD5 66671fb1faa8f073a0ac6762a2b40954
BLAKE2b-256 7eec82148eba324ccf74f9dabbd4926df3b55946359937351234294cc4b9e8a1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: python_gfm-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 19.1 MB
  • 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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 df2c8e48cd45474ac256ba455f6d59afad9dea8c3851f970d4fa54f3ce9a449f
MD5 eef9a95904892bdeab6f8127dd9e100d
BLAKE2b-256 0e2a6312ffa4dd4374810be59b0373eca63a4e3448761a4db5ae1793224aef24

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