# ISONeT++ Model: isonet_node on aids

Trained on the **large** split.

## Usage

```python
import torch
import json
from utils.tooling import make_read_only
from subgraph_matching.model_handler import get_model
from subgraph_matching.test import evaluate_model


from huggingface_hub import hf_hub_download

model_name = "isonet_node"
dataset_name = "aids"

REPO_ID = "structlearning/isonetpp-benchmark"  # change if you fork/rename

def _load_module_from_hub(repo_id, filename, repo_type="dataset", module_name=None):
    path = hf_hub_download(repo_id=repo_id, filename=filename, repo_type=repo_type)
    name = module_name or filename.rsplit(".", 1)[0]
    spec = importlib.util.spec_from_file_location(name, path)
    mod = importlib.util.module_from_spec(spec)
    sys.modules[name] = mod
    spec.loader.exec_module(mod)
    return mod

dataset_mod = _load_module_from_hub(REPO_ID, "subiso_dataset.py", repo_type="dataset", module_name="subiso_dataset")
loader = _load_module_from_hub(REPO_ID, "isonetpp_loader.py", repo_type="dataset", module_name="isonetpp_loader")


ds_test = loader.load_isonetpp_benchmark(
    repo_id=REPO_ID,
    mode="test",           # "train" | "val" | "test"
    dataset_name="aids"
)

repo_id = f"structlearning/isonetpp-isonet_node-aids-large"

# Load config
config = json.load(open(hf_hub_download(repo_id, "config.json")))
config = make_read_only(config)

# Load weights
weights = hf_hub_download(repo_id, "pytorch_model.bin")
state = torch.load(weights,  weights_only=False)

# Load dataset
ds_test = loader.load_isonetpp_benchmark(dataset_name="aids", mode="test")

model = get_model(
    model_name=config.name,
    config=config.model_config,
    max_node_set_size=ds_test.max_node_set_size,
    max_edge_set_size=ds_test.max_edge_set_size,
    device="cuda"
)
model.load_state_dict(state)
model.to("cuda")

_, map_val = evaluate_model(model, ds_test)
print(map_val)

```
Downloads last month
17
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train structlearning/isonetpp-isonet_node-aids-large