ONNX
josh-gregory commited on
Commit
4353e12
·
verified ·
1 Parent(s): d5a0332

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +28 -101
README.md CHANGED
@@ -2,11 +2,13 @@
2
  license: gpl-3.0
3
  ---
4
 
5
- # Model Card for ClotSimNet
6
 
7
  <!-- Provide a quick summary of what the model is/does. -->
8
 
9
- This is the HuggingFace storage location for all of the models for the ClotSimNet project. They include several base models as well as their tuned variants. All models were trained in PyTorch.
 
 
10
 
11
  ## Model Details
12
 
@@ -15,20 +17,15 @@ This is the HuggingFace storage location for all of the models for the ClotSimNe
15
  There are several models that were trained on the ClotSimNet dataset:
16
 
17
  * EfficientNet (B0, B3, B7)
18
- * ResNet (50, 152)
19
- * ConvNeXt-Large
20
 
21
- <!-- Provide a longer summary of what this model is. -->
22
 
23
 
24
 
25
  - **Developed by:** Josh Gregory
26
- - **Funded by [optional]:** [More Information Needed]
27
- - **Shared by [optional]:** [More Information Needed]
28
- - **Model type:** [More Information Needed]
29
- - **Language(s) (NLP):** [More Information Needed]
30
- - **License:** [More Information Needed]
31
- - **Finetuned from model [optional]:** [More Information Needed]
32
 
33
  ### Model Sources [optional]
34
 
@@ -36,106 +33,44 @@ Each model was imported using the instructions from the [PyTorch documentation](
36
 
37
  * [EfficientNet](https://proceedings.mlr.press/v97/tan19a.html)
38
  * [ResNet](https://ieeexplore.ieee.org/document/7780459)
39
- * [ConvNeXt-Large](https://ieeexplore.ieee.org/document/9879745)
40
 
41
  ## Uses
42
 
43
  These models are intended to be used to predict permeabilities from porous simulations, such as those found in blood clots or other porous media. The training set was exclusively computational fluid dynamics (CFD) simulations of blood clots, however these models could be fine-tuned on other porous media datasets.
44
 
45
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
46
-
47
  ### Direct Use
48
 
49
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
50
-
51
- [More Information Needed]
52
-
53
- ### Downstream Use [optional]
54
-
55
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
56
-
57
- [More Information Needed]
58
 
59
  ### Out-of-Scope Use
60
 
61
- As of this publication, these models are not intended to treat, diagnose, or prevent any disease. They have not been approved by the FDA and are not intended for clinical or human use.
62
 
63
  ## How to Get Started with the Model
64
 
65
- There are two flavors of each model. The base variants all had the same learning rate, weight decay, etc. Specifically for the CNNs:
66
-
67
- * Learning rate: 1e-3
68
- * Weight decay: 1e-5
69
- * Kernel size: 3
70
- * Stride: 2
71
- * Padding: 1
72
- * Use ImageNet pre-trained weights: True
73
- * Batch size: 2
74
- * Num workers: 70
75
- * Epochs: 500
76
- * Use image augmentation transforms: True
77
- * Learning rate reduction factor: 0.1
78
- * Learning rate reduction patience: 10
79
- * Learning rate reduction threshold: 1e-4
80
-
81
- For the MLPs, obviously things like the stride and padding are not applicable. Instead, the number of neurons per hidden layer and the number of hidden layers were set as:
82
 
83
- * Number of hidden layers: 3
84
- * Size of each hidden layer: 128
85
-
86
- Each model was exported in [ONNX](https://onnx.ai/) (`.onnx`) and [Safetensors](https://huggingface.co/docs/safetensors/index) (`.safetensors`).
87
 
88
  ### Loading the Models
89
 
90
- To import the ONNX (`.onnx`) file:
91
-
92
- ```python
93
- import onnx
94
- import onnxruntime as ort
95
- import numpy as np
96
-
97
-
98
- # Load ONNX model
99
- model = onnx.load('path_to_model/model.onnx')
100
-
101
- # Validate model
102
- onnx.checker.check_model(onnx_model)
103
-
104
- # Create an inference session
105
- session = ort.InferenceSession('path_to_model/model.onnx')
106
- ```
107
-
108
- TODO: Update inference to work with images
109
-
110
-
111
- [More Information Needed]
112
 
113
  ## Training Details
114
 
115
  ### Training Data
116
 
117
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
118
-
119
- [More Information Needed]
120
 
121
  ### Training Procedure
122
 
123
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
124
-
125
- #### Preprocessing [optional]
126
-
127
- [More Information Needed]
128
 
129
 
130
  #### Training Hyperparameters
131
 
132
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
133
-
134
- #### Speeds, Sizes, Times [optional]
135
-
136
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
137
-
138
- [More Information Needed]
139
 
140
  ## Evaluation
141
 
@@ -147,13 +82,7 @@ TODO: Update inference to work with images
147
 
148
  <!-- This should link to a Dataset Card if possible. -->
149
 
150
- [More Information Needed]
151
-
152
- #### Factors
153
-
154
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
155
-
156
- [More Information Needed]
157
 
158
  #### Metrics
159
 
@@ -163,11 +92,11 @@ TODO: Update inference to work with images
163
 
164
  ### Results
165
 
166
- [More Information Needed]
167
 
168
  #### Summary
169
 
170
-
171
 
172
  ## Model Examination [optional]
173
 
@@ -183,27 +112,25 @@ Carbon emissions can be estimated using the [Machine Learning Impact calculator]
183
 
184
  - **Hardware Type:** [More Information Needed]
185
  - **Hours used:** [More Information Needed]
186
- - **Cloud Provider:** [More Information Needed]
187
- - **Compute Region:** [More Information Needed]
188
  - **Carbon Emitted:** [More Information Needed]
189
 
190
- ## Technical Specifications [optional]
191
 
192
  ### Model Architecture and Objective
193
 
194
- [More Information Needed]
195
 
196
  ### Compute Infrastructure
197
 
198
- [More Information Needed]
199
 
200
  #### Hardware
201
 
202
- [More Information Needed]
203
 
204
  #### Software
205
 
206
- [More Information Needed]
207
 
208
  ## Citation [optional]
209
 
@@ -227,10 +154,10 @@ Carbon emissions can be estimated using the [Machine Learning Impact calculator]
227
 
228
  [More Information Needed]
229
 
230
- ## Model Card Authors [optional]
231
 
232
- [More Information Needed]
233
 
234
  ## Model Card Contact
235
 
236
- [More Information Needed]
 
2
  license: gpl-3.0
3
  ---
4
 
5
+ # Model Card for PoreSimNet
6
 
7
  <!-- Provide a quick summary of what the model is/does. -->
8
 
9
+ This is the HuggingFace storage location for all of the models for the PoreSimNet project. They include several base models as well as their tuned variants. All models were trained in PyTorch.
10
+
11
+ The PoreSimNet GitHub repository can be found [here](https://github.com/flowlabcu/ClotSimNet).
12
 
13
  ## Model Details
14
 
 
17
  There are several models that were trained on the ClotSimNet dataset:
18
 
19
  * EfficientNet (B0, B3, B7)
20
+ * ResNet (18, 50, 152)
21
+ * ConvNeXt-Tiny
22
 
23
+ The EfficientNet and ResNet models were chosen due to their precedence in the biomedical imaging field. ConvNeXt-Tiny was selected to explore a new architecture based on vision transformers to assess its performance relative to the more conventional CNN architectures.
24
 
25
 
26
 
27
  - **Developed by:** Josh Gregory
28
+
 
 
 
 
 
29
 
30
  ### Model Sources [optional]
31
 
 
33
 
34
  * [EfficientNet](https://proceedings.mlr.press/v97/tan19a.html)
35
  * [ResNet](https://ieeexplore.ieee.org/document/7780459)
36
+ * [ConvNeXt-Tiny](https://ieeexplore.ieee.org/document/9879745)
37
 
38
  ## Uses
39
 
40
  These models are intended to be used to predict permeabilities from porous simulations, such as those found in blood clots or other porous media. The training set was exclusively computational fluid dynamics (CFD) simulations of blood clots, however these models could be fine-tuned on other porous media datasets.
41
 
 
 
42
  ### Direct Use
43
 
44
+ These models are intended to predict permeability of porous media in environments with low Reynolds numbers (Re < 10).
 
 
 
 
 
 
 
 
45
 
46
  ### Out-of-Scope Use
47
 
48
+ As of this publication, these models are not intended to treat, diagnose, or prevent any disease and have not been approved by the FDA.
49
 
50
  ## How to Get Started with the Model
51
 
52
+ Each model was exported in [ONNX](https://onnx.ai/) (`.onnx`) and [Safetensors](https://huggingface.co/docs/safetensors/index) (`.safetensors`).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
+ See the `inference_examples` directory for how to inference these models in safetensors format. For futher examples in ONNX, refer to the GitHub repository, with examples located in the path `/poresimnet/ml/inference`.
 
 
 
55
 
56
  ### Loading the Models
57
 
58
+ See the `inference_examples` directory. Models in the safetensors format were used the most for internal inference work.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
  ## Training Details
61
 
62
  ### Training Data
63
 
64
+ All of the data can be found [here](link to Dataset card once it becomes public). Refer to the Dataset card to find the relevant training data, as different kinds exist.
 
 
65
 
66
  ### Training Procedure
67
 
68
+ All models were trained for 350 epochs with an early stopping patience of 70 epochs. Each model was then hyperparameter tuned for 24 hours and retrained with its tuned hyperparameters. For base hyperparameters, refer to each model's class in the `model_classes` directory.
 
 
 
 
69
 
70
 
71
  #### Training Hyperparameters
72
 
73
+ All models were trained in bf16 mixed precision and were tuned for 24 hours on an NVIDIA GH200.
 
 
 
 
 
 
74
 
75
  ## Evaluation
76
 
 
82
 
83
  <!-- This should link to a Dataset Card if possible. -->
84
 
85
+ Refer to the Dataset card to find the relevant testing data, as different kinds exist.
 
 
 
 
 
 
86
 
87
  #### Metrics
88
 
 
92
 
93
  ### Results
94
 
95
+ The ResNet-50 and ResNet-152 architectures were found to work the best for our task, as they were the only two that were able to generalize between the augmented training data and the un-augmented validation data.
96
 
97
  #### Summary
98
 
99
+ The `base` directory contains all trained models with base hyperparameters. The `tuned` directory contains the models after hyperparameter tuning. The `hyperparameters` folder itself contains each model's tuned hyperparameters in a JSON file, and the `inference_examples` directory contains examples for how to inference our models in safetensors format.
100
 
101
  ## Model Examination [optional]
102
 
 
112
 
113
  - **Hardware Type:** [More Information Needed]
114
  - **Hours used:** [More Information Needed]
 
 
115
  - **Carbon Emitted:** [More Information Needed]
116
 
117
+ ## Technical Specifications
118
 
119
  ### Model Architecture and Objective
120
 
121
+ Several architectures were considered. Both MLPs and CNNs were selected due to the fundamental difference in which they would estimate permeability.
122
 
123
  ### Compute Infrastructure
124
 
125
+ This work utilized the Alpine high performance computing resource at the University of Colorado Boulder. Alpine is jointly funded by the University of Colorado Boulder, the University of Colorado Anschutz, and Colorado State University and with support from NSF grants OAC-2201538 and OAC-2322260
126
 
127
  #### Hardware
128
 
129
+ A single NVIDIA GH200 was used to train and tune all models, coupling an NVIDIA H100 GPU with the 72-core Grace CPU.
130
 
131
  #### Software
132
 
133
+ All models were written in PyTorch Lightning.
134
 
135
  ## Citation [optional]
136
 
 
154
 
155
  [More Information Needed]
156
 
157
+ ## Model Card Authors
158
 
159
+ Josh Gregory
160
 
161
  ## Model Card Contact
162
 
163
+ Debanjan Mukherjee: debanjan@colorado.edu