28
28
#include < faiss/impl/CodePacker.h>
29
29
#include < faiss/impl/FaissAssert.h>
30
30
#include < faiss/impl/IDSelector.h>
31
- #include < fmt/core.h>
32
31
33
32
namespace faiss {
34
33
@@ -63,19 +62,18 @@ void Level1Quantizer::train_q1(
63
62
size_t d = quantizer->d ;
64
63
if (quantizer->is_trained && (quantizer->ntotal == nlist)) {
65
64
if (verbose)
66
- fmt::print (" IVF quantizer does not need training.\n " );
65
+ printf (" IVF quantizer does not need training.\n " );
67
66
} else if (quantizer_trains_alone == 1 ) {
68
67
if (verbose)
69
- fmt::print (" IVF quantizer trains alone...\n " );
68
+ printf (" IVF quantizer trains alone...\n " );
70
69
quantizer->train (n, x);
71
70
quantizer->verbose = verbose;
72
71
FAISS_THROW_IF_NOT_MSG (
73
72
quantizer->ntotal == nlist,
74
73
" nlist not consistent with quantizer size" );
75
74
} else if (quantizer_trains_alone == 0 ) {
76
75
if (verbose)
77
- fmt::print (
78
- " Training level-1 quantizer on {} vectors in {}D\n " , n, d);
76
+ printf (" Training level-1 quantizer on %zd vectors in %zdD\n " , n, d);
79
77
80
78
Clustering clus (d, nlist, cp);
81
79
quantizer->reset ();
@@ -88,11 +86,10 @@ void Level1Quantizer::train_q1(
88
86
quantizer->is_trained = true ;
89
87
} else if (quantizer_trains_alone == 2 ) {
90
88
if (verbose) {
91
- fmt::print (
92
- " Training L2 quantizer on {} vectors in {}D{}\n " ,
93
- n,
94
- d,
95
- clustering_index ? " (user provided index)" : " " );
89
+ printf (" Training L2 quantizer on %zd vectors in %zdD%s\n " ,
90
+ n,
91
+ d,
92
+ clustering_index ? " (user provided index)" : " " );
96
93
}
97
94
// also accept spherical centroids because in that case
98
95
// L2 and IP are equivalent
@@ -108,11 +105,11 @@ void Level1Quantizer::train_q1(
108
105
clus.train (n, x, *clustering_index);
109
106
}
110
107
if (verbose) {
111
- fmt::print (" Adding centroids to quantizer\n " );
108
+ printf (" Adding centroids to quantizer\n " );
112
109
}
113
110
if (!quantizer->is_trained ) {
114
111
if (verbose) {
115
- fmt::print (" But training it first on centroids table...\n " );
112
+ printf (" But training it first on centroids table...\n " );
116
113
}
117
114
quantizer->train (nlist, clus.centroids .data ());
118
115
}
@@ -213,10 +210,9 @@ void IndexIVF::add_core(
213
210
for (idx_t i0 = 0 ; i0 < n; i0 += bs) {
214
211
idx_t i1 = std::min (n, i0 + bs);
215
212
if (verbose) {
216
- fmt::print (
217
- " IndexIVF::add_with_ids %" PRId64 " :%" PRId64 " \n " ,
218
- i0,
219
- i1);
213
+ printf (" IndexIVF::add_with_ids %" PRId64 " :%" PRId64 " \n " ,
214
+ i0,
215
+ i1);
220
216
}
221
217
add_core (
222
218
i1 - i0,
@@ -265,11 +261,10 @@ void IndexIVF::add_core(
265
261
}
266
262
267
263
if (verbose) {
268
- fmt::print (
269
- " added {} / %" PRId64 " vectors ({} -1s)\n " ,
270
- nadd,
271
- n,
272
- nminus1);
264
+ printf (" added %zd / %" PRId64 " vectors (%zd -1s)\n " ,
265
+ nadd,
266
+ n,
267
+ nminus1);
273
268
}
274
269
275
270
ntotal += n;
@@ -1133,13 +1128,13 @@ void IndexIVF::update_vectors(int n, const idx_t* new_ids, const float* x) {
1133
1128
1134
1129
void IndexIVF::train (idx_t n, const float * x) {
1135
1130
if (verbose) {
1136
- fmt::print (" Training level-1 quantizer\n " );
1131
+ printf (" Training level-1 quantizer\n " );
1137
1132
}
1138
1133
1139
1134
train_q1 (n, x, verbose, metric_type);
1140
1135
1141
1136
if (verbose) {
1142
- fmt::print (" Training IVF residual\n " );
1137
+ printf (" Training IVF residual\n " );
1143
1138
}
1144
1139
1145
1140
// optional subsampling
@@ -1176,7 +1171,7 @@ void IndexIVF::train_encoder(
1176
1171
const idx_t * assign) {
1177
1172
// does nothing by default
1178
1173
if (verbose) {
1179
- fmt::print (" IndexIVF: no residual training\n " );
1174
+ printf (" IndexIVF: no residual training\n " );
1180
1175
}
1181
1176
}
1182
1177
0 commit comments