davanstrien HF staff commited on
Commit
d16e515
·
1 Parent(s): 79f2ae1

use onnx backend

Browse files
Files changed (3) hide show
  1. main.py +1 -1
  2. requirements.in +1 -1
  3. requirements.txt +74 -5
main.py CHANGED
@@ -49,7 +49,7 @@ app.add_middleware(
49
  )
50
 
51
  # Initialize model and DuckDB
52
- model = SentenceTransformer("nomic-ai/modernbert-embed-base", device="cpu")
53
  embedding_dim = model.get_sentence_embedding_dimension()
54
 
55
  # Database setup with fallback
 
49
  )
50
 
51
  # Initialize model and DuckDB
52
+ model = SentenceTransformer("nomic-ai/modernbert-embed-base", backend="onnx")
53
  embedding_dim = model.get_sentence_embedding_dimension()
54
 
55
  # Database setup with fallback
requirements.in CHANGED
@@ -8,7 +8,7 @@ pandas
8
  pydantic
9
  polars
10
  python-dotenv
11
- sentence-transformers
12
  stamina
13
  tqdm
14
  uvicorn
 
8
  pydantic
9
  polars
10
  python-dotenv
11
+ sentence-transformers[onnx]
12
  stamina
13
  tqdm
14
  uvicorn
requirements.txt CHANGED
@@ -3,7 +3,10 @@
3
  aiohappyeyeballs==2.4.6
4
  # via aiohttp
5
  aiohttp==3.11.12
6
- # via -r requirements.in
 
 
 
7
  aiosignal==1.3.2
8
  # via aiohttp
9
  annotated-types==0.7.0
@@ -25,10 +28,23 @@ charset-normalizer==3.4.1
25
  # via requests
26
  click==8.1.8
27
  # via uvicorn
 
 
 
 
 
 
 
 
 
 
 
28
  duckdb==1.2.0
29
  # via -r requirements.in
30
  einops==0.8.1
31
  # via -r requirements.in
 
 
32
  fastapi==0.115.8
33
  # via -r requirements.in
34
  filelock==3.17.0
@@ -36,12 +52,16 @@ filelock==3.17.0
36
  # huggingface-hub
37
  # torch
38
  # transformers
 
 
39
  frozenlist==1.5.0
40
  # via
41
  # aiohttp
42
  # aiosignal
43
  fsspec==2025.2.0
44
  # via
 
 
45
  # huggingface-hub
46
  # torch
47
  h11==0.14.0
@@ -61,9 +81,14 @@ httpx==0.28.1
61
  huggingface-hub==0.28.1
62
  # via
63
  # -r requirements.in
 
 
 
64
  # sentence-transformers
65
  # tokenizers
66
  # transformers
 
 
67
  hyperframe==6.1.0
68
  # via h2
69
  idna==3.10
@@ -84,20 +109,42 @@ multidict==6.1.0
84
  # via
85
  # aiohttp
86
  # yarl
 
 
 
 
87
  networkx==3.4.2
88
  # via torch
89
  numpy==2.2.2
90
  # via
 
 
 
 
 
91
  # pandas
92
  # scikit-learn
93
  # scipy
94
  # transformers
 
 
 
 
 
 
95
  packaging==24.2
96
  # via
 
 
97
  # huggingface-hub
 
 
98
  # transformers
99
  pandas==2.2.3
100
- # via -r requirements.in
 
 
 
101
  pillow==11.1.0
102
  # via sentence-transformers
103
  polars==1.22.0
@@ -106,6 +153,13 @@ propcache==0.2.1
106
  # via
107
  # aiohttp
108
  # yarl
 
 
 
 
 
 
 
109
  pydantic==2.10.6
110
  # via
111
  # -r requirements.in
@@ -120,12 +174,15 @@ pytz==2025.1
120
  # via pandas
121
  pyyaml==6.0.2
122
  # via
 
123
  # huggingface-hub
124
  # transformers
125
  regex==2024.11.6
126
  # via transformers
127
  requests==2.32.3
128
  # via
 
 
129
  # huggingface-hub
130
  # transformers
131
  safetensors==0.5.2
@@ -149,7 +206,9 @@ stamina==24.3.0
149
  starlette==0.45.3
150
  # via fastapi
151
  sympy==1.13.1
152
- # via torch
 
 
153
  tenacity==9.0.0
154
  # via stamina
155
  threadpoolctl==3.5.0
@@ -157,15 +216,21 @@ threadpoolctl==3.5.0
157
  tokenizers==0.21.0
158
  # via transformers
159
  torch==2.6.0
160
- # via sentence-transformers
 
 
161
  tqdm==4.67.1
162
  # via
163
  # -r requirements.in
 
 
164
  # huggingface-hub
165
  # sentence-transformers
166
  # transformers
167
  transformers==4.48.3
168
- # via sentence-transformers
 
 
169
  typing-extensions==4.12.2
170
  # via
171
  # anyio
@@ -180,5 +245,9 @@ urllib3==2.3.0
180
  # via requests
181
  uvicorn==0.34.0
182
  # via -r requirements.in
 
 
 
 
183
  yarl==1.18.3
184
  # via aiohttp
 
3
  aiohappyeyeballs==2.4.6
4
  # via aiohttp
5
  aiohttp==3.11.12
6
+ # via
7
+ # -r requirements.in
8
+ # datasets
9
+ # fsspec
10
  aiosignal==1.3.2
11
  # via aiohttp
12
  annotated-types==0.7.0
 
28
  # via requests
29
  click==8.1.8
30
  # via uvicorn
31
+ coloredlogs==15.0.1
32
+ # via onnxruntime
33
+ datasets==2.14.4
34
+ # via
35
+ # evaluate
36
+ # optimum
37
+ dill==0.3.7
38
+ # via
39
+ # datasets
40
+ # evaluate
41
+ # multiprocess
42
  duckdb==1.2.0
43
  # via -r requirements.in
44
  einops==0.8.1
45
  # via -r requirements.in
46
+ evaluate==0.4.3
47
+ # via optimum
48
  fastapi==0.115.8
49
  # via -r requirements.in
50
  filelock==3.17.0
 
52
  # huggingface-hub
53
  # torch
54
  # transformers
55
+ flatbuffers==25.2.10
56
+ # via onnxruntime
57
  frozenlist==1.5.0
58
  # via
59
  # aiohttp
60
  # aiosignal
61
  fsspec==2025.2.0
62
  # via
63
+ # datasets
64
+ # evaluate
65
  # huggingface-hub
66
  # torch
67
  h11==0.14.0
 
81
  huggingface-hub==0.28.1
82
  # via
83
  # -r requirements.in
84
+ # datasets
85
+ # evaluate
86
+ # optimum
87
  # sentence-transformers
88
  # tokenizers
89
  # transformers
90
+ humanfriendly==10.0
91
+ # via coloredlogs
92
  hyperframe==6.1.0
93
  # via h2
94
  idna==3.10
 
109
  # via
110
  # aiohttp
111
  # yarl
112
+ multiprocess==0.70.15
113
+ # via
114
+ # datasets
115
+ # evaluate
116
  networkx==3.4.2
117
  # via torch
118
  numpy==2.2.2
119
  # via
120
+ # datasets
121
+ # evaluate
122
+ # onnx
123
+ # onnxruntime
124
+ # optimum
125
  # pandas
126
  # scikit-learn
127
  # scipy
128
  # transformers
129
+ onnx==1.17.0
130
+ # via optimum
131
+ onnxruntime==1.20.1
132
+ # via optimum
133
+ optimum==1.24.0
134
+ # via sentence-transformers
135
  packaging==24.2
136
  # via
137
+ # datasets
138
+ # evaluate
139
  # huggingface-hub
140
+ # onnxruntime
141
+ # optimum
142
  # transformers
143
  pandas==2.2.3
144
+ # via
145
+ # -r requirements.in
146
+ # datasets
147
+ # evaluate
148
  pillow==11.1.0
149
  # via sentence-transformers
150
  polars==1.22.0
 
153
  # via
154
  # aiohttp
155
  # yarl
156
+ protobuf==5.29.3
157
+ # via
158
+ # onnx
159
+ # onnxruntime
160
+ # optimum
161
+ pyarrow==19.0.0
162
+ # via datasets
163
  pydantic==2.10.6
164
  # via
165
  # -r requirements.in
 
174
  # via pandas
175
  pyyaml==6.0.2
176
  # via
177
+ # datasets
178
  # huggingface-hub
179
  # transformers
180
  regex==2024.11.6
181
  # via transformers
182
  requests==2.32.3
183
  # via
184
+ # datasets
185
+ # evaluate
186
  # huggingface-hub
187
  # transformers
188
  safetensors==0.5.2
 
206
  starlette==0.45.3
207
  # via fastapi
208
  sympy==1.13.1
209
+ # via
210
+ # onnxruntime
211
+ # torch
212
  tenacity==9.0.0
213
  # via stamina
214
  threadpoolctl==3.5.0
 
216
  tokenizers==0.21.0
217
  # via transformers
218
  torch==2.6.0
219
+ # via
220
+ # optimum
221
+ # sentence-transformers
222
  tqdm==4.67.1
223
  # via
224
  # -r requirements.in
225
+ # datasets
226
+ # evaluate
227
  # huggingface-hub
228
  # sentence-transformers
229
  # transformers
230
  transformers==4.48.3
231
+ # via
232
+ # optimum
233
+ # sentence-transformers
234
  typing-extensions==4.12.2
235
  # via
236
  # anyio
 
245
  # via requests
246
  uvicorn==0.34.0
247
  # via -r requirements.in
248
+ xxhash==3.5.0
249
+ # via
250
+ # datasets
251
+ # evaluate
252
  yarl==1.18.3
253
  # via aiohttp