Views
No views yet
base_model/)finetuned_model/)1import torch
2from moml.models.mgnn.djmgnn import DJMGNN
3
4# Initialize model architecture
5model = DJMGNN(
6 in_node_dim=29, # Adjust based on your featurization
7 in_edge_dim=0,
8 hidden_dim=128,
9 n_blocks=4,
10 layers_per_block=6,
11 node_output_dims=3,
12 graph_output_dims=19,
13 energy_output_dims=1,
14 jk_mode="attention",
15 dropout=0.2,
16 use_supernode=True,
17 use_rbf=True,
18 rbf_K=32
19)
20
21# Load base model checkpoint
22checkpoint = torch.hub.load_state_dict_from_url(
23 "https://huggingface.co/saketh11/MoML-CA/resolve/main/base_model/pytorch_model.pt"
24)
25model.load_state_dict(checkpoint["model_state_dict"])
26model.eval()1# Same architecture setup as above, then:
2checkpoint = torch.hub.load_state_dict_from_url(
3 "https://huggingface.co/saketh11/MoML-CA/resolve/main/finetuned_model/pytorch_model.pt"
4)
5model.load_state_dict(checkpoint["model_state_dict"])
6model.eval()1# Assuming you have a molecular graph 'data' (torch_geometric.data.Data)
2with torch.no_grad():
3 output = model(
4 x=data.x,
5 edge_index=data.edge_index,
6 edge_attr=data.edge_attr,
7 batch=data.batch
8 )
9
10 # Extract predictions
11 node_predictions = output["node_pred"] # Per-atom properties/forces
12 graph_predictions = output["graph_pred"] # Molecular descriptors
13 energy_predictions = output["energy_pred"] # Total energy