mlunar commited on
Commit
b98d24d
β€’
1 Parent(s): 7a358d7

Add shape inference for textual models

Browse files
Files changed (6) hide show
  1. .gitignore +1 -0
  2. README.md +98 -98
  3. convert.py +1 -1
  4. poetry.lock +51 -45
  5. pyproject.toml +1 -0
  6. variants.py +28 -24
.gitignore CHANGED
@@ -1,2 +1,3 @@
1
  __pycache__
2
  .venv
 
 
1
  __pycache__
2
  .venv
3
+ converted
README.md CHANGED
@@ -121,104 +121,104 @@ The models were converted into multiple data types as well.
121
 
122
  ## Variants
123
 
124
- | Path | Model ID | Mode | Data Type | Available | Size (MB) |
125
- |--------------------------------------------------------|-----------------------|---------|--------------------|-------------|-------------|
126
- | models/clip-resnet-50-visual.onnx | resnet-50 | visual | float32 (original) | βœ… | 153 |
127
- | models/clip-resnet-50-visual-float16.onnx | resnet-50 | visual | float16 | βœ… | 77 |
128
- | models/clip-resnet-50-visual-qint8.onnx | resnet-50 | visual | qint8 | βœ… | 39 |
129
- | models/clip-resnet-50-visual-quint8.onnx | resnet-50 | visual | quint8 | βœ… | 39 |
130
- | models/clip-resnet-50-textual.onnx | resnet-50 | textual | float32 (original) | βœ… | 255 |
131
- | models/clip-resnet-50-textual-float16.onnx | resnet-50 | textual | float16 | βœ… | 128 |
132
- | models/clip-resnet-50-textual-qint8.onnx | resnet-50 | textual | qint8 | βœ… | 64 |
133
- | models/clip-resnet-50-textual-quint8.onnx | resnet-50 | textual | quint8 | βœ… | 64 |
134
- | models/clip-resnet-101-visual.onnx | resnet-101 | visual | float32 (original) | βœ… | 225 |
135
- | models/clip-resnet-101-visual-float16.onnx | resnet-101 | visual | float16 | βœ… | 112 |
136
- | models/clip-resnet-101-visual-qint8.onnx | resnet-101 | visual | qint8 | βœ… | 57 |
137
- | models/clip-resnet-101-visual-quint8.onnx | resnet-101 | visual | quint8 | βœ… | 57 |
138
- | models/clip-resnet-101-textual.onnx | resnet-101 | textual | float32 (original) | βœ… | 254 |
139
- | models/clip-resnet-101-textual-float16.onnx | resnet-101 | textual | float16 | βœ… | 127 |
140
- | models/clip-resnet-101-textual-qint8.onnx | resnet-101 | textual | qint8 | βœ… | 64 |
141
- | models/clip-resnet-101-textual-quint8.onnx | resnet-101 | textual | quint8 | βœ… | 64 |
142
- | models/clip-resnet-50x4-visual.onnx | resnet-50x4 | visual | float32 (original) | βœ… | 348 |
143
- | models/clip-resnet-50x4-visual-float16.onnx | resnet-50x4 | visual | float16 | βœ… | 174 |
144
- | models/clip-resnet-50x4-visual-qint8.onnx | resnet-50x4 | visual | qint8 | βœ… | 88 |
145
- | models/clip-resnet-50x4-visual-quint8.onnx | resnet-50x4 | visual | quint8 | βœ… | 88 |
146
- | models/clip-resnet-50x4-textual.onnx | resnet-50x4 | textual | float32 (original) | βœ… | 365 |
147
- | models/clip-resnet-50x4-textual-float16.onnx | resnet-50x4 | textual | float16 | βœ… | 183 |
148
- | models/clip-resnet-50x4-textual-qint8.onnx | resnet-50x4 | textual | qint8 | βœ… | 92 |
149
- | models/clip-resnet-50x4-textual-quint8.onnx | resnet-50x4 | textual | quint8 | βœ… | 92 |
150
- | models/clip-resnet-50x16-visual.onnx | resnet-50x16 | visual | float32 (original) | βœ… | 669 |
151
- | models/clip-resnet-50x16-visual-float16.onnx | resnet-50x16 | visual | float16 | βœ… | 335 |
152
- | models/clip-resnet-50x16-visual-qint8.onnx | resnet-50x16 | visual | qint8 | βœ… | 169 |
153
- | models/clip-resnet-50x16-visual-quint8.onnx | resnet-50x16 | visual | quint8 | βœ… | 169 |
154
- | models/clip-resnet-50x16-textual.onnx | resnet-50x16 | textual | float32 (original) | βœ… | 495 |
155
- | models/clip-resnet-50x16-textual-float16.onnx | resnet-50x16 | textual | float16 | βœ… | 248 |
156
- | models/clip-resnet-50x16-textual-qint8.onnx | resnet-50x16 | textual | qint8 | βœ… | 124 |
157
- | models/clip-resnet-50x16-textual-quint8.onnx | resnet-50x16 | textual | quint8 | βœ… | 124 |
158
- | models/clip-resnet-50x64-visual.onnx | resnet-50x64 | visual | float32 (original) | βœ… | 1681 |
159
- | models/clip-resnet-50x64-visual-float16.onnx | resnet-50x64 | visual | float16 | βœ… | 840 |
160
- | models/clip-resnet-50x64-visual-qint8.onnx | resnet-50x64 | visual | qint8 | βœ… | 424 |
161
- | models/clip-resnet-50x64-visual-quint8.onnx | resnet-50x64 | visual | quint8 | βœ… | 424 |
162
- | models/clip-resnet-50x64-textual.onnx | resnet-50x64 | textual | float32 (original) | βœ… | 812 |
163
- | models/clip-resnet-50x64-textual-float16.onnx | resnet-50x64 | textual | float16 | βœ… | 406 |
164
- | models/clip-resnet-50x64-textual-qint8.onnx | resnet-50x64 | textual | qint8 | βœ… | 204 |
165
- | models/clip-resnet-50x64-textual-quint8.onnx | resnet-50x64 | textual | quint8 | βœ… | 204 |
166
- | models/clip-resnet-50-visual.onnx | resnet-50 | visual | float32 (original) | βœ… | 153 |
167
- | models/clip-resnet-50-visual-float16.onnx | resnet-50 | visual | float16 | βœ… | 77 |
168
- | models/clip-resnet-50-visual-qint8.onnx | resnet-50 | visual | qint8 | βœ… | 39 |
169
- | models/clip-resnet-50-visual-quint8.onnx | resnet-50 | visual | quint8 | βœ… | 39 |
170
- | models/clip-resnet-50-textual.onnx | resnet-50 | textual | float32 (original) | βœ… | 255 |
171
- | models/clip-resnet-50-textual-float16.onnx | resnet-50 | textual | float16 | βœ… | 128 |
172
- | models/clip-resnet-50-textual-qint8.onnx | resnet-50 | textual | qint8 | βœ… | 64 |
173
- | models/clip-resnet-50-textual-quint8.onnx | resnet-50 | textual | quint8 | βœ… | 64 |
174
- | models/clip-resnet-50-visual.onnx | resnet-50 | visual | float32 (original) | βœ… | 153 |
175
- | models/clip-resnet-50-visual-float16.onnx | resnet-50 | visual | float16 | βœ… | 77 |
176
- | models/clip-resnet-50-visual-qint8.onnx | resnet-50 | visual | qint8 | βœ… | 39 |
177
- | models/clip-resnet-50-visual-quint8.onnx | resnet-50 | visual | quint8 | βœ… | 39 |
178
- | models/clip-resnet-50-textual.onnx | resnet-50 | textual | float32 (original) | βœ… | 255 |
179
- | models/clip-resnet-50-textual-float16.onnx | resnet-50 | textual | float16 | βœ… | 128 |
180
- | models/clip-resnet-50-textual-qint8.onnx | resnet-50 | textual | qint8 | βœ… | 64 |
181
- | models/clip-resnet-50-textual-quint8.onnx | resnet-50 | textual | quint8 | βœ… | 64 |
182
- | models/clip-resnet-50-visual.onnx | resnet-50 | visual | float32 (original) | βœ… | 153 |
183
- | models/clip-resnet-50-visual-float16.onnx | resnet-50 | visual | float16 | βœ… | 77 |
184
- | models/clip-resnet-50-visual-qint8.onnx | resnet-50 | visual | qint8 | βœ… | 39 |
185
- | models/clip-resnet-50-visual-quint8.onnx | resnet-50 | visual | quint8 | βœ… | 39 |
186
- | models/clip-resnet-50-textual.onnx | resnet-50 | textual | float32 (original) | βœ… | 255 |
187
- | models/clip-resnet-50-textual-float16.onnx | resnet-50 | textual | float16 | βœ… | 128 |
188
- | models/clip-resnet-50-textual-qint8.onnx | resnet-50 | textual | qint8 | βœ… | 64 |
189
- | models/clip-resnet-50-textual-quint8.onnx | resnet-50 | textual | quint8 | βœ… | 64 |
190
- | models/clip-vit-base-patch16-visual.onnx | vit-base-patch16 | visual | float32 (original) | βœ… | 345 |
191
- | models/clip-vit-base-patch16-visual-float16.onnx | vit-base-patch16 | visual | float16 | βœ… | 173 |
192
- | models/clip-vit-base-patch16-visual-qint8.onnx | vit-base-patch16 | visual | qint8 | βœ… | 87 |
193
- | models/clip-vit-base-patch16-visual-quint8.onnx | vit-base-patch16 | visual | quint8 | βœ… | 87 |
194
- | models/clip-vit-base-patch16-textual.onnx | vit-base-patch16 | textual | float32 (original) | βœ… | 254 |
195
- | models/clip-vit-base-patch16-textual-float16.onnx | vit-base-patch16 | textual | float16 | βœ… | 127 |
196
- | models/clip-vit-base-patch16-textual-qint8.onnx | vit-base-patch16 | textual | qint8 | βœ… | 64 |
197
- | models/clip-vit-base-patch16-textual-quint8.onnx | vit-base-patch16 | textual | quint8 | βœ… | 64 |
198
- | models/clip-vit-base-patch32-visual.onnx | vit-base-patch32 | visual | float32 (original) | βœ… | 352 |
199
- | models/clip-vit-base-patch32-visual-float16.onnx | vit-base-patch32 | visual | float16 | βœ… | 176 |
200
- | models/clip-vit-base-patch32-visual-qint8.onnx | vit-base-patch32 | visual | qint8 | βœ… | 89 |
201
- | models/clip-vit-base-patch32-visual-quint8.onnx | vit-base-patch32 | visual | quint8 | βœ… | 89 |
202
- | models/clip-vit-base-patch32-textual.onnx | vit-base-patch32 | textual | float32 (original) | βœ… | 254 |
203
- | models/clip-vit-base-patch32-textual-float16.onnx | vit-base-patch32 | textual | float16 | βœ… | 127 |
204
- | models/clip-vit-base-patch32-textual-qint8.onnx | vit-base-patch32 | textual | qint8 | βœ… | 64 |
205
- | models/clip-vit-base-patch32-textual-quint8.onnx | vit-base-patch32 | textual | quint8 | βœ… | 64 |
206
- | models/clip-vit-large-patch14-visual.onnx | vit-large-patch14 | visual | float32 (original) | βœ… | 1216 |
207
- | models/clip-vit-large-patch14-visual-float16.onnx | vit-large-patch14 | visual | float16 | βœ… | 608 |
208
- | models/clip-vit-large-patch14-visual-qint8.onnx | vit-large-patch14 | visual | qint8 | βœ… | 306 |
209
- | models/clip-vit-large-patch14-visual-quint8.onnx | vit-large-patch14 | visual | quint8 | βœ… | 306 |
210
- | models/clip-vit-large-patch14-textual.onnx | vit-large-patch14 | textual | float32 (original) | βœ… | 495 |
211
- | models/clip-vit-large-patch14-textual-float16.onnx | vit-large-patch14 | textual | float16 | βœ… | 247 |
212
- | models/clip-vit-large-patch14-textual-qint8.onnx | vit-large-patch14 | textual | qint8 | βœ… | 124 |
213
- | models/clip-vit-large-patch14-textual-quint8.onnx | vit-large-patch14 | textual | quint8 | βœ… | 124 |
214
- | models/clip-vit-large-patch14-336-visual.onnx | vit-large-patch14-336 | visual | float32 (original) | βœ… | 1217 |
215
- | models/clip-vit-large-patch14-336-visual-float16.onnx | vit-large-patch14-336 | visual | float16 | βœ… | 609 |
216
- | models/clip-vit-large-patch14-336-visual-qint8.onnx | vit-large-patch14-336 | visual | qint8 | βœ… | 307 |
217
- | models/clip-vit-large-patch14-336-visual-quint8.onnx | vit-large-patch14-336 | visual | quint8 | βœ… | 307 |
218
- | models/clip-vit-large-patch14-336-textual.onnx | vit-large-patch14-336 | textual | float32 (original) | βœ… | 495 |
219
- | models/clip-vit-large-patch14-336-textual-float16.onnx | vit-large-patch14-336 | textual | float16 | βœ… | 247 |
220
- | models/clip-vit-large-patch14-336-textual-qint8.onnx | vit-large-patch14-336 | textual | qint8 | βœ… | 124 |
221
- | models/clip-vit-large-patch14-336-textual-quint8.onnx | vit-large-patch14-336 | textual | quint8 | βœ… | 124 |
222
 
223
  [onnx]: https://onnx.ai/
224
  [clip]: https://github.com/openai/CLIP
 
121
 
122
  ## Variants
123
 
124
+ | Path | Model ID | Mode | Data Type | Available | Size (MB) |
125
+ |--------------------------------------------------------|-----------------------|---------|-------------|-------------|-------------|
126
+ | models/clip-resnet-50-visual-float32.onnx | resnet-50 | visual | float32 | βœ… | 153 |
127
+ | models/clip-resnet-50-visual-float16.onnx | resnet-50 | visual | float16 | βœ… | 77 |
128
+ | models/clip-resnet-50-visual-qint8.onnx | resnet-50 | visual | qint8 | βœ… | 39 |
129
+ | models/clip-resnet-50-visual-quint8.onnx | resnet-50 | visual | quint8 | βœ… | 39 |
130
+ | models/clip-resnet-50-textual-float32.onnx | resnet-50 | textual | float32 | βœ… | 255 |
131
+ | models/clip-resnet-50-textual-float16.onnx | resnet-50 | textual | float16 | βœ… | 128 |
132
+ | models/clip-resnet-50-textual-qint8.onnx | resnet-50 | textual | qint8 | βœ… | 64 |
133
+ | models/clip-resnet-50-textual-quint8.onnx | resnet-50 | textual | quint8 | βœ… | 64 |
134
+ | models/clip-resnet-101-visual-float32.onnx | resnet-101 | visual | float32 | βœ… | 225 |
135
+ | models/clip-resnet-101-visual-float16.onnx | resnet-101 | visual | float16 | βœ… | 112 |
136
+ | models/clip-resnet-101-visual-qint8.onnx | resnet-101 | visual | qint8 | βœ… | 57 |
137
+ | models/clip-resnet-101-visual-quint8.onnx | resnet-101 | visual | quint8 | βœ… | 57 |
138
+ | models/clip-resnet-101-textual-float32.onnx | resnet-101 | textual | float32 | βœ… | 254 |
139
+ | models/clip-resnet-101-textual-float16.onnx | resnet-101 | textual | float16 | βœ… | 127 |
140
+ | models/clip-resnet-101-textual-qint8.onnx | resnet-101 | textual | qint8 | βœ… | 64 |
141
+ | models/clip-resnet-101-textual-quint8.onnx | resnet-101 | textual | quint8 | βœ… | 64 |
142
+ | models/clip-resnet-50x4-visual-float32.onnx | resnet-50x4 | visual | float32 | βœ… | 348 |
143
+ | models/clip-resnet-50x4-visual-float16.onnx | resnet-50x4 | visual | float16 | βœ… | 174 |
144
+ | models/clip-resnet-50x4-visual-qint8.onnx | resnet-50x4 | visual | qint8 | βœ… | 88 |
145
+ | models/clip-resnet-50x4-visual-quint8.onnx | resnet-50x4 | visual | quint8 | βœ… | 88 |
146
+ | models/clip-resnet-50x4-textual-float32.onnx | resnet-50x4 | textual | float32 | βœ… | 365 |
147
+ | models/clip-resnet-50x4-textual-float16.onnx | resnet-50x4 | textual | float16 | βœ… | 183 |
148
+ | models/clip-resnet-50x4-textual-qint8.onnx | resnet-50x4 | textual | qint8 | βœ… | 92 |
149
+ | models/clip-resnet-50x4-textual-quint8.onnx | resnet-50x4 | textual | quint8 | βœ… | 92 |
150
+ | models/clip-resnet-50x16-visual-float32.onnx | resnet-50x16 | visual | float32 | βœ… | 669 |
151
+ | models/clip-resnet-50x16-visual-float16.onnx | resnet-50x16 | visual | float16 | βœ… | 335 |
152
+ | models/clip-resnet-50x16-visual-qint8.onnx | resnet-50x16 | visual | qint8 | βœ… | 169 |
153
+ | models/clip-resnet-50x16-visual-quint8.onnx | resnet-50x16 | visual | quint8 | βœ… | 169 |
154
+ | models/clip-resnet-50x16-textual-float32.onnx | resnet-50x16 | textual | float32 | βœ… | 495 |
155
+ | models/clip-resnet-50x16-textual-float16.onnx | resnet-50x16 | textual | float16 | βœ… | 248 |
156
+ | models/clip-resnet-50x16-textual-qint8.onnx | resnet-50x16 | textual | qint8 | βœ… | 124 |
157
+ | models/clip-resnet-50x16-textual-quint8.onnx | resnet-50x16 | textual | quint8 | βœ… | 124 |
158
+ | models/clip-resnet-50x64-visual-float32.onnx | resnet-50x64 | visual | float32 | βœ… | 1681 |
159
+ | models/clip-resnet-50x64-visual-float16.onnx | resnet-50x64 | visual | float16 | βœ… | 840 |
160
+ | models/clip-resnet-50x64-visual-qint8.onnx | resnet-50x64 | visual | qint8 | βœ… | 424 |
161
+ | models/clip-resnet-50x64-visual-quint8.onnx | resnet-50x64 | visual | quint8 | βœ… | 424 |
162
+ | models/clip-resnet-50x64-textual-float32.onnx | resnet-50x64 | textual | float32 | βœ… | 812 |
163
+ | models/clip-resnet-50x64-textual-float16.onnx | resnet-50x64 | textual | float16 | βœ… | 406 |
164
+ | models/clip-resnet-50x64-textual-qint8.onnx | resnet-50x64 | textual | qint8 | βœ… | 204 |
165
+ | models/clip-resnet-50x64-textual-quint8.onnx | resnet-50x64 | textual | quint8 | βœ… | 204 |
166
+ | models/clip-resnet-50-visual-float32.onnx | resnet-50 | visual | float32 | βœ… | 153 |
167
+ | models/clip-resnet-50-visual-float16.onnx | resnet-50 | visual | float16 | βœ… | 77 |
168
+ | models/clip-resnet-50-visual-qint8.onnx | resnet-50 | visual | qint8 | βœ… | 39 |
169
+ | models/clip-resnet-50-visual-quint8.onnx | resnet-50 | visual | quint8 | βœ… | 39 |
170
+ | models/clip-resnet-50-textual-float32.onnx | resnet-50 | textual | float32 | βœ… | 255 |
171
+ | models/clip-resnet-50-textual-float16.onnx | resnet-50 | textual | float16 | βœ… | 128 |
172
+ | models/clip-resnet-50-textual-qint8.onnx | resnet-50 | textual | qint8 | βœ… | 64 |
173
+ | models/clip-resnet-50-textual-quint8.onnx | resnet-50 | textual | quint8 | βœ… | 64 |
174
+ | models/clip-resnet-50-visual-float32.onnx | resnet-50 | visual | float32 | βœ… | 153 |
175
+ | models/clip-resnet-50-visual-float16.onnx | resnet-50 | visual | float16 | βœ… | 77 |
176
+ | models/clip-resnet-50-visual-qint8.onnx | resnet-50 | visual | qint8 | βœ… | 39 |
177
+ | models/clip-resnet-50-visual-quint8.onnx | resnet-50 | visual | quint8 | βœ… | 39 |
178
+ | models/clip-resnet-50-textual-float32.onnx | resnet-50 | textual | float32 | βœ… | 255 |
179
+ | models/clip-resnet-50-textual-float16.onnx | resnet-50 | textual | float16 | βœ… | 128 |
180
+ | models/clip-resnet-50-textual-qint8.onnx | resnet-50 | textual | qint8 | βœ… | 64 |
181
+ | models/clip-resnet-50-textual-quint8.onnx | resnet-50 | textual | quint8 | βœ… | 64 |
182
+ | models/clip-resnet-50-visual-float32.onnx | resnet-50 | visual | float32 | βœ… | 153 |
183
+ | models/clip-resnet-50-visual-float16.onnx | resnet-50 | visual | float16 | βœ… | 77 |
184
+ | models/clip-resnet-50-visual-qint8.onnx | resnet-50 | visual | qint8 | βœ… | 39 |
185
+ | models/clip-resnet-50-visual-quint8.onnx | resnet-50 | visual | quint8 | βœ… | 39 |
186
+ | models/clip-resnet-50-textual-float32.onnx | resnet-50 | textual | float32 | βœ… | 255 |
187
+ | models/clip-resnet-50-textual-float16.onnx | resnet-50 | textual | float16 | βœ… | 128 |
188
+ | models/clip-resnet-50-textual-qint8.onnx | resnet-50 | textual | qint8 | βœ… | 64 |
189
+ | models/clip-resnet-50-textual-quint8.onnx | resnet-50 | textual | quint8 | βœ… | 64 |
190
+ | models/clip-vit-base-patch16-visual-float32.onnx | vit-base-patch16 | visual | float32 | βœ… | 345 |
191
+ | models/clip-vit-base-patch16-visual-float16.onnx | vit-base-patch16 | visual | float16 | βœ… | 173 |
192
+ | models/clip-vit-base-patch16-visual-qint8.onnx | vit-base-patch16 | visual | qint8 | βœ… | 87 |
193
+ | models/clip-vit-base-patch16-visual-quint8.onnx | vit-base-patch16 | visual | quint8 | βœ… | 87 |
194
+ | models/clip-vit-base-patch16-textual-float32.onnx | vit-base-patch16 | textual | float32 | βœ… | 254 |
195
+ | models/clip-vit-base-patch16-textual-float16.onnx | vit-base-patch16 | textual | float16 | βœ… | 127 |
196
+ | models/clip-vit-base-patch16-textual-qint8.onnx | vit-base-patch16 | textual | qint8 | βœ… | 64 |
197
+ | models/clip-vit-base-patch16-textual-quint8.onnx | vit-base-patch16 | textual | quint8 | βœ… | 64 |
198
+ | models/clip-vit-base-patch32-visual-float32.onnx | vit-base-patch32 | visual | float32 | βœ… | 352 |
199
+ | models/clip-vit-base-patch32-visual-float16.onnx | vit-base-patch32 | visual | float16 | βœ… | 176 |
200
+ | models/clip-vit-base-patch32-visual-qint8.onnx | vit-base-patch32 | visual | qint8 | βœ… | 89 |
201
+ | models/clip-vit-base-patch32-visual-quint8.onnx | vit-base-patch32 | visual | quint8 | βœ… | 89 |
202
+ | models/clip-vit-base-patch32-textual-float32.onnx | vit-base-patch32 | textual | float32 | βœ… | 254 |
203
+ | models/clip-vit-base-patch32-textual-float16.onnx | vit-base-patch32 | textual | float16 | βœ… | 127 |
204
+ | models/clip-vit-base-patch32-textual-qint8.onnx | vit-base-patch32 | textual | qint8 | βœ… | 64 |
205
+ | models/clip-vit-base-patch32-textual-quint8.onnx | vit-base-patch32 | textual | quint8 | βœ… | 64 |
206
+ | models/clip-vit-large-patch14-visual-float32.onnx | vit-large-patch14 | visual | float32 | βœ… | 1216 |
207
+ | models/clip-vit-large-patch14-visual-float16.onnx | vit-large-patch14 | visual | float16 | βœ… | 608 |
208
+ | models/clip-vit-large-patch14-visual-qint8.onnx | vit-large-patch14 | visual | qint8 | βœ… | 306 |
209
+ | models/clip-vit-large-patch14-visual-quint8.onnx | vit-large-patch14 | visual | quint8 | βœ… | 306 |
210
+ | models/clip-vit-large-patch14-textual-float32.onnx | vit-large-patch14 | textual | float32 | βœ… | 495 |
211
+ | models/clip-vit-large-patch14-textual-float16.onnx | vit-large-patch14 | textual | float16 | βœ… | 248 |
212
+ | models/clip-vit-large-patch14-textual-qint8.onnx | vit-large-patch14 | textual | qint8 | βœ… | 124 |
213
+ | models/clip-vit-large-patch14-textual-quint8.onnx | vit-large-patch14 | textual | quint8 | βœ… | 124 |
214
+ | models/clip-vit-large-patch14-336-visual-float32.onnx | vit-large-patch14-336 | visual | float32 | βœ… | 1217 |
215
+ | models/clip-vit-large-patch14-336-visual-float16.onnx | vit-large-patch14-336 | visual | float16 | βœ… | 609 |
216
+ | models/clip-vit-large-patch14-336-visual-qint8.onnx | vit-large-patch14-336 | visual | qint8 | βœ… | 307 |
217
+ | models/clip-vit-large-patch14-336-visual-quint8.onnx | vit-large-patch14-336 | visual | quint8 | βœ… | 307 |
218
+ | models/clip-vit-large-patch14-336-textual-float32.onnx | vit-large-patch14-336 | textual | float32 | βœ… | 495 |
219
+ | models/clip-vit-large-patch14-336-textual-float16.onnx | vit-large-patch14-336 | textual | float16 | βœ… | 248 |
220
+ | models/clip-vit-large-patch14-336-textual-qint8.onnx | vit-large-patch14-336 | textual | qint8 | βœ… | 124 |
221
+ | models/clip-vit-large-patch14-336-textual-quint8.onnx | vit-large-patch14-336 | textual | quint8 | βœ… | 124 |
222
 
223
  [onnx]: https://onnx.ai/
224
  [clip]: https://github.com/openai/CLIP
convert.py CHANGED
@@ -70,7 +70,7 @@ def convert(model_name, dashed_name):
70
 
71
  device = "cuda" if torch.cuda.is_available() else "cpu"
72
  device = "cpu"
73
- output_dir = "models"
74
  if __name__ == "__main__":
75
  print(f"Torch device: {device}")
76
 
 
70
 
71
  device = "cuda" if torch.cuda.is_available() else "cpu"
72
  device = "cpu"
73
+ output_dir = "converted"
74
  if __name__ == "__main__":
75
  print(f"Torch device: {device}")
76
 
poetry.lock CHANGED
@@ -132,7 +132,7 @@ python-versions = ">=3.8"
132
 
133
  [[package]]
134
  name = "onnx"
135
- version = "1.11.0"
136
  description = "Open Neural Network Exchange"
137
  category = "main"
138
  optional = false
@@ -140,11 +140,11 @@ python-versions = "*"
140
 
141
  [package.dependencies]
142
  numpy = ">=1.16.6"
143
- protobuf = ">=3.12.2"
144
  typing-extensions = ">=3.6.2.1"
145
 
146
  [package.extras]
147
- mypy = ["mypy (==0.782)", "types-protobuf (==3.18.4)"]
148
 
149
  [[package]]
150
  name = "onnxconverter-common"
@@ -213,8 +213,8 @@ tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "pa
213
 
214
  [[package]]
215
  name = "protobuf"
216
- version = "4.21.7"
217
- description = ""
218
  category = "main"
219
  optional = false
220
  python-versions = ">=3.7"
@@ -429,7 +429,7 @@ python-versions = "*"
429
  [metadata]
430
  lock-version = "1.1"
431
  python-versions = "^3.9"
432
- content-hash = "2d11d7968b077f8474fb974736347963175d486d3d0e83cbcfd8d2d16b9a9703"
433
 
434
  [metadata.files]
435
  certifi = [
@@ -503,31 +503,27 @@ numpy = [
503
  {file = "numpy-1.23.3.tar.gz", hash = "sha256:51bf49c0cd1d52be0a240aa66f3458afc4b95d8993d2d04f0d91fa60c10af6cd"},
504
  ]
505
  onnx = [
506
- {file = "onnx-1.11.0-cp36-cp36m-macosx_10_12_x86_64.whl", hash = "sha256:a6e9135f1d02539ca7573f699fb0d31d3c43d10fac1d2d2239a9a1c553506c29"},
507
- {file = "onnx-1.11.0-cp36-cp36m-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:b2de0b117ad77689d308824a0c9eb89539ec28a799b4e2e05b3bb977b0da0b45"},
508
- {file = "onnx-1.11.0-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:f335d982b8ed201cf767459b993630acfd20c32b100529f70af9f28a26e72167"},
509
- {file = "onnx-1.11.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:593ca9e11f15afa26b3aaf2d170bb803d4bd86dbd560aa7be4e5f535d03f83d5"},
510
- {file = "onnx-1.11.0-cp36-cp36m-win32.whl", hash = "sha256:df85666ab2b88fd9cf9b2504bcb551da39422eab65a143926a8db58f81b09164"},
511
- {file = "onnx-1.11.0-cp36-cp36m-win_amd64.whl", hash = "sha256:82221a07707b1ccf71fb18c6abb77f2566517a55d5185809775b5ff008bfb35c"},
512
- {file = "onnx-1.11.0-cp37-cp37m-macosx_10_12_x86_64.whl", hash = "sha256:4aa899f74acd4c5543f0efed8bfe98a3b701df75c5ffa179212e3088c51971bb"},
513
- {file = "onnx-1.11.0-cp37-cp37m-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:58d4873ec587ac14c44227d8027787edc88cd61596e646e3417f2a826a920898"},
514
- {file = "onnx-1.11.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:7a2f5d6998fe79aed80fad9d4522140d02c4d29513047e335d5c5355c1ebda5e"},
515
- {file = "onnx-1.11.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:eb46f31f12bb0bfdcfb68497d10b20447cf8fa6c4f693120c013e052645357b8"},
516
- {file = "onnx-1.11.0-cp37-cp37m-win32.whl", hash = "sha256:997d91ffd7b7ae7aee09c6d652a896d906be430d425865c759b51a8de5df9fe0"},
517
- {file = "onnx-1.11.0-cp37-cp37m-win_amd64.whl", hash = "sha256:ea06dbf57a287657b6dc4e189918e4cb451450308589d482117216194d6f83d6"},
518
- {file = "onnx-1.11.0-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:c3d3503110f2cab2c818f4a7b2bc8abc3bc79649daa39e70d5fb504b208ddb1e"},
519
- {file = "onnx-1.11.0-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:9b9f58ea01c1b20b057f55f628df4fc0403bbc160b7282a56e3bb4df5c7fb96f"},
520
- {file = "onnx-1.11.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:89420e5b824d7e182846fe2aa09190ddb41162b261465c6ca928174bc2ac10b7"},
521
- {file = "onnx-1.11.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d6ddbe89e32f885db736d36fcb132784e368331a18c3b6168ac9f561eb462057"},
522
- {file = "onnx-1.11.0-cp38-cp38-win32.whl", hash = "sha256:0cf47c205b376b3763beef92a6de4152f3b1552d6f640d93044938500baf5958"},
523
- {file = "onnx-1.11.0-cp38-cp38-win_amd64.whl", hash = "sha256:d6581dd2122525549d1d8b431b8bf375298993c77bddb8fd0bf0d92611df76a1"},
524
- {file = "onnx-1.11.0-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:4454906de80a351de6929b0896ad605d106c324c3112c92249240e531f68fbba"},
525
- {file = "onnx-1.11.0-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:ae74bf8fa343b64e2b7fe205091b7f3728887c018ae061d161dd86ec95eb66a8"},
526
- {file = "onnx-1.11.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:67c6d2654c1c203e5c839a47900b51f588fd0de71bbd497fb193d30a0b3ec1e9"},
527
- {file = "onnx-1.11.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:43b32a2f20c94aa98866deae9e4218faf0495144ad05402e918fa279674b6df9"},
528
- {file = "onnx-1.11.0-cp39-cp39-win32.whl", hash = "sha256:7924d9baa13dbbf335737229f6d068f380d153679f357e495da60007b61cf56d"},
529
- {file = "onnx-1.11.0-cp39-cp39-win_amd64.whl", hash = "sha256:3403884c482859f8cf2e0c276da84bd9ac2235d266726f4ddc9625d3fd263218"},
530
- {file = "onnx-1.11.0.tar.gz", hash = "sha256:eca224c7c2c8ee4072a0743e4898a84a9bdf8297b5e5910a2632e4c4182ffb2a"},
531
  ]
532
  onnxconverter-common = [
533
  {file = "onnxconverter_common-1.12.2-py2.py3-none-any.whl", hash = "sha256:29b7caade27aeda1b827232554cec352db8afc6e16c3e3ea8c4264449f9ff3a6"},
@@ -629,20 +625,30 @@ Pillow = [
629
  {file = "Pillow-9.2.0.tar.gz", hash = "sha256:75e636fd3e0fb872693f23ccb8a5ff2cd578801251f3a4f6854c6a5d437d3c04"},
630
  ]
631
  protobuf = [
632
- {file = "protobuf-4.21.7-cp310-abi3-win32.whl", hash = "sha256:c7cb105d69a87416bd9023e64324e1c089593e6dae64d2536f06bcbe49cd97d8"},
633
- {file = "protobuf-4.21.7-cp310-abi3-win_amd64.whl", hash = "sha256:3ec85328a35a16463c6f419dbce3c0fc42b3e904d966f17f48bae39597c7a543"},
634
- {file = "protobuf-4.21.7-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:db9056b6a11cb5131036d734bcbf91ef3ef9235d6b681b2fc431cbfe5a7f2e56"},
635
- {file = "protobuf-4.21.7-cp37-abi3-manylinux2014_aarch64.whl", hash = "sha256:ca200645d6235ce0df3ccfdff1567acbab35c4db222a97357806e015f85b5744"},
636
- {file = "protobuf-4.21.7-cp37-abi3-manylinux2014_x86_64.whl", hash = "sha256:b019c79e23a80735cc8a71b95f76a49a262f579d6b84fd20a0b82279f40e2cc1"},
637
- {file = "protobuf-4.21.7-cp37-cp37m-win32.whl", hash = "sha256:d3f89ccf7182293feba2de2739c8bf34fed1ed7c65a5cf987be00311acac57c1"},
638
- {file = "protobuf-4.21.7-cp37-cp37m-win_amd64.whl", hash = "sha256:a74d96cd960b87b4b712797c741bb3ea3a913f5c2dc4b6cbe9c0f8360b75297d"},
639
- {file = "protobuf-4.21.7-cp38-cp38-win32.whl", hash = "sha256:8e09d1916386eca1ef1353767b6efcebc0a6859ed7f73cb7fb974feba3184830"},
640
- {file = "protobuf-4.21.7-cp38-cp38-win_amd64.whl", hash = "sha256:9e355f2a839d9930d83971b9f562395e13493f0e9211520f8913bd11efa53c02"},
641
- {file = "protobuf-4.21.7-cp39-cp39-win32.whl", hash = "sha256:f370c0a71712f8965023dd5b13277444d3cdfecc96b2c778b0e19acbfd60df6e"},
642
- {file = "protobuf-4.21.7-cp39-cp39-win_amd64.whl", hash = "sha256:9643684232b6b340b5e63bb69c9b4904cdd39e4303d498d1a92abddc7e895b7f"},
643
- {file = "protobuf-4.21.7-py2.py3-none-any.whl", hash = "sha256:8066322588d4b499869bf9f665ebe448e793036b552f68c585a9b28f1e393f66"},
644
- {file = "protobuf-4.21.7-py3-none-any.whl", hash = "sha256:58b81358ec6c0b5d50df761460ae2db58405c063fd415e1101209221a0a810e1"},
645
- {file = "protobuf-4.21.7.tar.gz", hash = "sha256:71d9dba03ed3432c878a801e2ea51e034b0ea01cf3a4344fb60166cb5f6c8757"},
 
 
 
 
 
 
 
 
 
 
646
  ]
647
  pyparsing = [
648
  {file = "pyparsing-3.0.9-py3-none-any.whl", hash = "sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc"},
 
132
 
133
  [[package]]
134
  name = "onnx"
135
+ version = "1.12.0"
136
  description = "Open Neural Network Exchange"
137
  category = "main"
138
  optional = false
 
140
 
141
  [package.dependencies]
142
  numpy = ">=1.16.6"
143
+ protobuf = ">=3.12.2,<=3.20.1"
144
  typing-extensions = ">=3.6.2.1"
145
 
146
  [package.extras]
147
+ lint = ["clang-format (==13.0.0)", "flake8", "mypy (==0.782)", "types-protobuf (==3.18.4)"]
148
 
149
  [[package]]
150
  name = "onnxconverter-common"
 
213
 
214
  [[package]]
215
  name = "protobuf"
216
+ version = "3.20.1"
217
+ description = "Protocol Buffers"
218
  category = "main"
219
  optional = false
220
  python-versions = ">=3.7"
 
429
  [metadata]
430
  lock-version = "1.1"
431
  python-versions = "^3.9"
432
+ content-hash = "52a34bba9b18b5fe6103778b608b973043ecb22db0162a3e721ee41229962029"
433
 
434
  [metadata.files]
435
  certifi = [
 
503
  {file = "numpy-1.23.3.tar.gz", hash = "sha256:51bf49c0cd1d52be0a240aa66f3458afc4b95d8993d2d04f0d91fa60c10af6cd"},
504
  ]
505
  onnx = [
506
+ {file = "onnx-1.12.0-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:bdbd2578424c70836f4d0f9dda16c21868ddb07cc8192f9e8a176908b43d694b"},
507
+ {file = "onnx-1.12.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:213e73610173f6b2e99f99a4b0636f80b379c417312079d603806e48ada4ca8b"},
508
+ {file = "onnx-1.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9fd2f4e23078df197bb76a59b9cd8f5a43a6ad2edc035edb3ecfb9042093e05a"},
509
+ {file = "onnx-1.12.0-cp310-cp310-win32.whl", hash = "sha256:23781594bb8b7ee985de1005b3c601648d5b0568a81e01365c48f91d1f5648e4"},
510
+ {file = "onnx-1.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:81a3555fd67be2518bf86096299b48fb9154652596219890abfe90bd43a9ec13"},
511
+ {file = "onnx-1.12.0-cp37-cp37m-macosx_10_12_x86_64.whl", hash = "sha256:5578b93dc6c918cec4dee7fb7d9dd3b09d338301ee64ca8b4f28bc217ed42dca"},
512
+ {file = "onnx-1.12.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c11162ffc487167da140f1112f49c4f82d815824f06e58bc3095407699f05863"},
513
+ {file = "onnx-1.12.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:341c7016e23273e9ffa9b6e301eee95b8c37d0f04df7cedbdb169d2c39524c96"},
514
+ {file = "onnx-1.12.0-cp37-cp37m-win32.whl", hash = "sha256:3c6e6bcffc3f5c1e148df3837dc667fa4c51999788c1b76b0b8fbba607e02da8"},
515
+ {file = "onnx-1.12.0-cp37-cp37m-win_amd64.whl", hash = "sha256:8a7aa61aea339bd28f310f4af4f52ce6c4b876386228760b16308efd58f95059"},
516
+ {file = "onnx-1.12.0-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:56ceb7e094c43882b723cfaa107d85ad673cfdf91faeb28d7dcadacca4f43a07"},
517
+ {file = "onnx-1.12.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b3629e8258db15d4e2c9b7f1be91a3186719dd94661c218c6f5fde3cc7de3d4d"},
518
+ {file = "onnx-1.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2d9a7db54e75529160337232282a4816cc50667dc7dc34be178fd6f6b79d4705"},
519
+ {file = "onnx-1.12.0-cp38-cp38-win32.whl", hash = "sha256:fea5156a03398fe0e23248042d8651c1eaac5f6637d4dd683b4c1f1320b9f7b4"},
520
+ {file = "onnx-1.12.0-cp38-cp38-win_amd64.whl", hash = "sha256:f66d2996e65f490a57b3ae952e4e9189b53cc9fe3f75e601d50d4db2dc1b1cd9"},
521
+ {file = "onnx-1.12.0-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:c39a7a0352c856f1df30dccf527eb6cb4909052e5eaf6fa2772a637324c526aa"},
522
+ {file = "onnx-1.12.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fab13feb4d94342aae6d357d480f2e47d41b9f4e584367542b21ca6defda9e0a"},
523
+ {file = "onnx-1.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c7a9b3ea02c30efc1d2662337e280266aca491a8e86be0d8a657f874b7cccd1e"},
524
+ {file = "onnx-1.12.0-cp39-cp39-win32.whl", hash = "sha256:f8800f28c746ab06e51ef8449fd1215621f4ddba91be3ffc264658937d38a2af"},
525
+ {file = "onnx-1.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:af90427ca04c6b7b8107c2021e1273227a3ef1a7a01f3073039cae7855a59833"},
526
+ {file = "onnx-1.12.0.tar.gz", hash = "sha256:13b3e77d27523b9dbf4f30dfc9c959455859d5e34e921c44f712d69b8369eff9"},
 
 
 
 
527
  ]
528
  onnxconverter-common = [
529
  {file = "onnxconverter_common-1.12.2-py2.py3-none-any.whl", hash = "sha256:29b7caade27aeda1b827232554cec352db8afc6e16c3e3ea8c4264449f9ff3a6"},
 
625
  {file = "Pillow-9.2.0.tar.gz", hash = "sha256:75e636fd3e0fb872693f23ccb8a5ff2cd578801251f3a4f6854c6a5d437d3c04"},
626
  ]
627
  protobuf = [
628
+ {file = "protobuf-3.20.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:3cc797c9d15d7689ed507b165cd05913acb992d78b379f6014e013f9ecb20996"},
629
+ {file = "protobuf-3.20.1-cp310-cp310-manylinux2014_aarch64.whl", hash = "sha256:ff8d8fa42675249bb456f5db06c00de6c2f4c27a065955917b28c4f15978b9c3"},
630
+ {file = "protobuf-3.20.1-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:cd68be2559e2a3b84f517fb029ee611546f7812b1fdd0aa2ecc9bc6ec0e4fdde"},
631
+ {file = "protobuf-3.20.1-cp310-cp310-win32.whl", hash = "sha256:9016d01c91e8e625141d24ec1b20fed584703e527d28512aa8c8707f105a683c"},
632
+ {file = "protobuf-3.20.1-cp310-cp310-win_amd64.whl", hash = "sha256:32ca378605b41fd180dfe4e14d3226386d8d1b002ab31c969c366549e66a2bb7"},
633
+ {file = "protobuf-3.20.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:9be73ad47579abc26c12024239d3540e6b765182a91dbc88e23658ab71767153"},
634
+ {file = "protobuf-3.20.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:097c5d8a9808302fb0da7e20edf0b8d4703274d140fd25c5edabddcde43e081f"},
635
+ {file = "protobuf-3.20.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:e250a42f15bf9d5b09fe1b293bdba2801cd520a9f5ea2d7fb7536d4441811d20"},
636
+ {file = "protobuf-3.20.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:cdee09140e1cd184ba9324ec1df410e7147242b94b5f8b0c64fc89e38a8ba531"},
637
+ {file = "protobuf-3.20.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:af0ebadc74e281a517141daad9d0f2c5d93ab78e9d455113719a45a49da9db4e"},
638
+ {file = "protobuf-3.20.1-cp37-cp37m-win32.whl", hash = "sha256:755f3aee41354ae395e104d62119cb223339a8f3276a0cd009ffabfcdd46bb0c"},
639
+ {file = "protobuf-3.20.1-cp37-cp37m-win_amd64.whl", hash = "sha256:62f1b5c4cd6c5402b4e2d63804ba49a327e0c386c99b1675c8a0fefda23b2067"},
640
+ {file = "protobuf-3.20.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:06059eb6953ff01e56a25cd02cca1a9649a75a7e65397b5b9b4e929ed71d10cf"},
641
+ {file = "protobuf-3.20.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:cb29edb9eab15742d791e1025dd7b6a8f6fcb53802ad2f6e3adcb102051063ab"},
642
+ {file = "protobuf-3.20.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:69ccfdf3657ba59569c64295b7d51325f91af586f8d5793b734260dfe2e94e2c"},
643
+ {file = "protobuf-3.20.1-cp38-cp38-win32.whl", hash = "sha256:dd5789b2948ca702c17027c84c2accb552fc30f4622a98ab5c51fcfe8c50d3e7"},
644
+ {file = "protobuf-3.20.1-cp38-cp38-win_amd64.whl", hash = "sha256:77053d28427a29987ca9caf7b72ccafee011257561259faba8dd308fda9a8739"},
645
+ {file = "protobuf-3.20.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:6f50601512a3d23625d8a85b1638d914a0970f17920ff39cec63aaef80a93fb7"},
646
+ {file = "protobuf-3.20.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:284f86a6207c897542d7e956eb243a36bb8f9564c1742b253462386e96c6b78f"},
647
+ {file = "protobuf-3.20.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:7403941f6d0992d40161aa8bb23e12575637008a5a02283a930addc0508982f9"},
648
+ {file = "protobuf-3.20.1-cp39-cp39-win32.whl", hash = "sha256:db977c4ca738dd9ce508557d4fce0f5aebd105e158c725beec86feb1f6bc20d8"},
649
+ {file = "protobuf-3.20.1-cp39-cp39-win_amd64.whl", hash = "sha256:7e371f10abe57cee5021797126c93479f59fccc9693dafd6bd5633ab67808a91"},
650
+ {file = "protobuf-3.20.1-py2.py3-none-any.whl", hash = "sha256:adfc6cf69c7f8c50fd24c793964eef18f0ac321315439d94945820612849c388"},
651
+ {file = "protobuf-3.20.1.tar.gz", hash = "sha256:adc31566d027f45efe3f44eeb5b1f329da43891634d61c75a5944e9be6dd42c9"},
652
  ]
653
  pyparsing = [
654
  {file = "pyparsing-3.0.9-py3-none-any.whl", hash = "sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc"},
pyproject.toml CHANGED
@@ -21,6 +21,7 @@ onnxconverter-common = "^1.12.2"
21
  tabulate = "^0.8.10"
22
  numpy = "^1.23.3"
23
  Pillow = "^9.2.0"
 
24
 
25
  [build-system]
26
  requires = ["poetry-core"]
 
21
  tabulate = "^0.8.10"
22
  numpy = "^1.23.3"
23
  Pillow = "^9.2.0"
24
+ onnx = "^1.12.0"
25
 
26
  [build-system]
27
  requires = ["poetry-core"]
variants.py CHANGED
@@ -2,11 +2,16 @@ import onnx
2
  import os
3
  import itertools
4
  import argparse
 
5
  from onnxconverter_common.float16 import convert_float_to_float16
6
  from onnxruntime.quantization import quantize_dynamic, QuantType
 
7
  from multiprocessing import Pool
8
  from tabulate import tabulate
9
 
 
 
 
10
  def float16(input, output):
11
  model = onnx.load(input)
12
  model_f16 = convert_float_to_float16(model)
@@ -18,6 +23,10 @@ def qint8(input, output):
18
  def quint8(input, output):
19
  quantize_dynamic(input, output, weight_type=QuantType.QUInt8)
20
 
 
 
 
 
21
  def print_table(table):
22
  print(tabulate(table, headers="keys", tablefmt="github"), "\n")
23
 
@@ -31,19 +40,25 @@ def get_file_mb(path):
31
 
32
  def convert(name, mode, f, markdown):
33
  fname = f.__name__
34
- input = f"models/clip-{name}-{mode}.onnx"
35
  output = f"models/clip-{name}-{mode}-{fname}.onnx"
36
  exists = os.path.exists(output)
 
 
37
  if exists:
38
- if not markdown:
39
- print(f"{output} exists")
40
  else:
41
- if not markdown:
 
42
  print(f"{output} converting")
43
- f(input, output)
44
- if not markdown:
45
- print(f"{output} done")
46
- return [input, output, name, mode, fname, "βœ…" if exists else "❌"]
 
 
 
 
47
 
48
  if __name__ == '__main__':
49
  parser = argparse.ArgumentParser(description='Create variants of converted models')
@@ -72,6 +87,7 @@ if __name__ == '__main__':
72
  "textual"
73
  ]
74
  funcs = [
 
75
  float16,
76
  qint8,
77
  quint8,
@@ -82,27 +98,15 @@ if __name__ == '__main__':
82
  print_table({ "Mode": modes })
83
  print_table({ "Data Type": [f.__name__ for f in funcs] })
84
  variants = itertools.product(names, modes, funcs, [markdown])
85
-
86
  with Pool(8 if not markdown else 1) as p:
87
  variants_table = p.starmap(convert, variants)
88
  if markdown:
89
- # Insert rows for the original models
90
- prev_input = ""
91
- variants_table_with_originals = []
92
  for row in variants_table:
93
- input = row[0]
94
- output = row[1]
95
- if input != prev_input:
96
- prev_input = input
97
- variants_table_with_originals.append(
98
- row[0:1] + row[2:4] + ["float32 (original)", "βœ…", get_file_mb(input)]
99
- )
100
  file_size = get_file_mb(output)
101
- variants_table_with_originals.append(row[1:] + [file_size])
102
- # Add header
103
- variants_table_with_originals.insert(0, ["Path", "Model ID", "Mode", "Data Type", "Available", "Size (MB)"])
104
- # Print
105
- print(tabulate(variants_table_with_originals, headers="firstrow", tablefmt="github"))
106
  else:
107
  print("done")
108
 
 
2
  import os
3
  import itertools
4
  import argparse
5
+ import shutil
6
  from onnxconverter_common.float16 import convert_float_to_float16
7
  from onnxruntime.quantization import quantize_dynamic, QuantType
8
+ from onnxruntime.tools.symbolic_shape_infer import SymbolicShapeInference
9
  from multiprocessing import Pool
10
  from tabulate import tabulate
11
 
12
+ def float32(input, output):
13
+ shutil.copy2(input, output)
14
+
15
  def float16(input, output):
16
  model = onnx.load(input)
17
  model_f16 = convert_float_to_float16(model)
 
23
  def quint8(input, output):
24
  quantize_dynamic(input, output, weight_type=QuantType.QUInt8)
25
 
26
+ def infer_shapes(input, output):
27
+ out_mp = SymbolicShapeInference.infer_shapes(onnx.load(input))
28
+ onnx.save(out_mp, output)
29
+
30
  def print_table(table):
31
  print(tabulate(table, headers="keys", tablefmt="github"), "\n")
32
 
 
40
 
41
  def convert(name, mode, f, markdown):
42
  fname = f.__name__
43
+ input = f"converted/clip-{name}-{mode}.onnx"
44
  output = f"models/clip-{name}-{mode}-{fname}.onnx"
45
  exists = os.path.exists(output)
46
+ if markdown:
47
+ return [output, name, mode, fname, "βœ…" if exists else "❌"]
48
  if exists:
49
+ print(f"{output} exists")
 
50
  else:
51
+ if mode == "textual":
52
+ output_temp = f"{output}.temp"
53
  print(f"{output} converting")
54
+ f(input, output_temp)
55
+ print(f"{output} running shape inference for TensorRT support")
56
+ infer_shapes(output_temp, output)
57
+ os.remove(output_temp)
58
+ else:
59
+ print(f"{output} converting")
60
+ f(input, output)
61
+ print(f"{output} done")
62
 
63
  if __name__ == '__main__':
64
  parser = argparse.ArgumentParser(description='Create variants of converted models')
 
87
  "textual"
88
  ]
89
  funcs = [
90
+ float32,
91
  float16,
92
  qint8,
93
  quint8,
 
98
  print_table({ "Mode": modes })
99
  print_table({ "Data Type": [f.__name__ for f in funcs] })
100
  variants = itertools.product(names, modes, funcs, [markdown])
 
101
  with Pool(8 if not markdown else 1) as p:
102
  variants_table = p.starmap(convert, variants)
103
  if markdown:
 
 
 
104
  for row in variants_table:
105
+ output = row[0]
 
 
 
 
 
 
106
  file_size = get_file_mb(output)
107
+ row.append(file_size)
108
+ variants_table.insert(0, ["Path", "Model ID", "Mode", "Data Type", "Available", "Size (MB)"])
109
+ print(tabulate(variants_table, headers="firstrow", tablefmt="github"))
 
 
110
  else:
111
  print("done")
112