saketh11 commited on
Commit
6539c24
·
verified ·
1 Parent(s): 998df90

Upload djmgnn-pfas-finetuned model

Browse files
finetuned_model/README.md ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - molecular-property-prediction
5
+ - graph-neural-network
6
+ - chemistry
7
+ - pytorch
8
+ datasets:
9
+ - qm9
10
+ - spice
11
+ - pfas
12
+ metrics:
13
+ - mse
14
+ - mae
15
+ pipeline_tag: graph-ml
16
+ library_name: moml
17
+ ---
18
+
19
+ # djmgnn-pfas-finetuned
20
+
21
+ ## Model Description
22
+
23
+ This is a fine-tuned **DJMGNN** (Dense Jump Multi-Graph Neural Network) model for molecular property prediction. The model is designed to predict various molecular properties from graph representations of molecules.
24
+
25
+ ### Architecture
26
+
27
+ - **Model Type**: Dense Jump Multi-Graph Neural Network (DJMGNN)
28
+ - **Framework**: PyTorch
29
+ - **Library**: MoML (Molecular Machine Learning)
30
+ - **Task**: Molecular Property Prediction
31
+
32
+ ### Model Architecture Details
33
+
34
+ - **Hidden Dimensions**: 128
35
+ - **Number of Blocks**: 3
36
+ - **Layers per Block**: 6
37
+ - **Input Node Dimensions**: 11
38
+ - **Input Edge Dimensions**: 0
39
+ - **Node Output Dimensions**: 3
40
+ - **Graph Output Dimensions**: 19
41
+ - **Energy Output Dimensions**: 1
42
+ - **Jumping Knowledge Mode**: cat
43
+ - **Dropout Rate**: 0.2
44
+ - **Uses Supernode**: True
45
+ - **Uses RBF Features**: True
46
+ - **RBF K**: 32
47
+
48
+ ## Training Details
49
+
50
+ ### Datasets
51
+
52
+ The model was trained on the following datasets:
53
+ - **QM9**: Quantum mechanical properties of small molecules
54
+ - **SPICE**: Molecular dynamics data with forces and energies
55
+ - **PFAS**: Per- and polyfluoroalkyl substances dataset
56
+
57
+ ### Training Configuration
58
+
59
+ ```yaml
60
+ batch_size: 32
61
+ early_stopping: true
62
+ epochs: 100
63
+ learning_rate: 0.001
64
+ optimizer: Adam
65
+ patience: 10
66
+ validation_split: 0.2
67
+
68
+ ```
69
+
70
+ ## Usage
71
+
72
+ ### Loading the Model
73
+
74
+ ```python
75
+ import torch
76
+ from moml.models.mgnn.djmgnn import DJMGNN
77
+
78
+ # Load the model
79
+ model = DJMGNN(
80
+ in_node_dim=11,
81
+ in_edge_dim=0,
82
+ hidden_dim=128,
83
+ n_blocks=3,
84
+ layers_per_block=6,
85
+ node_output_dims=3,
86
+ graph_output_dims=19,
87
+ energy_output_dims=1,
88
+ jk_mode="cat",
89
+ dropout=0.2,
90
+ use_supernode=true,
91
+ use_rbf=true,
92
+ rbf_K=32
93
+ )
94
+
95
+ # Load the checkpoint
96
+ checkpoint = torch.load("path/to/checkpoint.pt", map_location="cpu")
97
+ model.load_state_dict(checkpoint["model_state_dict"])
98
+ model.eval()
99
+ ```
100
+
101
+ ### Making Predictions
102
+
103
+ ```python
104
+ # Assuming you have a molecular graph 'data' (torch_geometric.data.Data object)
105
+ with torch.no_grad():
106
+ output = model(
107
+ x=data.x,
108
+ edge_index=data.edge_index,
109
+ edge_attr=data.edge_attr,
110
+ batch=data.batch
111
+ )
112
+
113
+ # Extract predictions
114
+ node_predictions = output["node_pred"] # Node-level predictions
115
+ graph_predictions = output["graph_pred"] # Graph-level predictions
116
+ energy_predictions = output["energy_pred"] # Energy predictions
117
+ ```
118
+
119
+ ## Model Performance
120
+
121
+ This model was fine-tuned from a base DJMGNN model on PFAS-specific data.
122
+
123
+ ## Citation
124
+
125
+ If you use this model in your research, please cite:
126
+
127
+ ```bibtex
128
+ @misc{djmgnn_model,
129
+ title={DJMGNN: Dense Jump Multi-Graph Neural Network for Molecular Property Prediction},
130
+ author={Your Name},
131
+ year={2024},
132
+ url={https://github.com/SAKETH11111/MoML-CA}
133
+ }
134
+ ```
135
+
136
+ ## License
137
+
138
+ This model is released under the MIT License.
139
+
140
+ ## Contact
141
+
142
+ For questions or issues, please contact [email protected] or open an issue in the [GitHub repository](https://github.com/SAKETH11111/MoML-CA).
finetuned_model/config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "djmgnn",
3
+ "architecture": "Dense Jump Multi-Graph Neural Network",
4
+ "task": "molecular_property_prediction",
5
+ "framework": "pytorch",
6
+ "library_name": "moml",
7
+ "hidden_dim": 128,
8
+ "n_blocks": 3,
9
+ "layers_per_block": 6,
10
+ "in_node_dim": 11,
11
+ "in_edge_dim": 0,
12
+ "node_output_dims": 3,
13
+ "graph_output_dims": 19,
14
+ "energy_output_dims": 1,
15
+ "jk_mode": "cat",
16
+ "dropout": 0.2,
17
+ "use_supernode": true,
18
+ "use_rbf": true,
19
+ "rbf_K": 32,
20
+ "training": {
21
+ "epochs": 100,
22
+ "batch_size": 32,
23
+ "learning_rate": 0.001,
24
+ "optimizer": "Adam",
25
+ "early_stopping": true,
26
+ "patience": 10,
27
+ "validation_split": 0.2
28
+ },
29
+ "checkpoint_path": "checkpoints/final_pfas_best.pt",
30
+ "model_name": "djmgnn-pfas-finetuned",
31
+ "license": "mit",
32
+ "tags": [
33
+ "molecular-property-prediction",
34
+ "graph-neural-network",
35
+ "chemistry",
36
+ "pytorch"
37
+ ],
38
+ "datasets": [
39
+ "qm9",
40
+ "spice",
41
+ "pfas"
42
+ ],
43
+ "metrics": [
44
+ "mse",
45
+ "mae"
46
+ ],
47
+ "pipeline_tag": "graph-ml"
48
+ }
finetuned_model/pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bac5dcb7ab9f9d59fd77b4ab02f4ce1380cf78d730e5541bdefd7d7d244a2f32
3
+ size 130213414
finetuned_model/upload.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ '''
3
+ Upload script for djmgnn-pfas-finetuned
4
+ '''
5
+
6
+ from huggingface_hub import HfApi, create_repo
7
+
8
+ def upload_model():
9
+ # Initialize API
10
+ api = HfApi()
11
+
12
+ # Create repository (if it doesn't exist)
13
+ repo_id = "saketh11/MoML-CA"
14
+
15
+ try:
16
+ create_repo(repo_id, exist_ok=True)
17
+ print(f"Repository {repo_id} created/verified")
18
+ except Exception as e:
19
+ print(f"Error creating repository: {e}")
20
+ return
21
+
22
+ # Upload files to finetuned_model subdirectory
23
+ api.upload_folder(
24
+ folder_path="hf_models/djmgnn_pfas_finetuned",
25
+ repo_id=repo_id,
26
+ path_in_repo="finetuned_model",
27
+ commit_message="Upload djmgnn-pfas-finetuned model"
28
+ )
29
+
30
+ print(f"Model uploaded successfully to https://huggingface.co/{repo_id}")
31
+
32
+ if __name__ == "__main__":
33
+ upload_model()