blob: 3d72355d3144d664695a23b5d5c93b9f39061e6f [file] [log] [blame]
Marc Kupietz50de14a2026-07-31 14:48:02 +09001/* Writes the memory mappable form of an already trained model, so that
2 * derekovecs does not have to build it itself on its first start. dereko2vec
3 * does this right after training, this tool is for models that were trained
4 * before, or whose converted files were lost.
5 */
6
7#include <stdio.h>
8#include <string.h>
9
10#include "mmap_vecs.h"
11
12int main(int argc, char **argv) {
13 int i;
14
15 if (argc < 2 || strcmp(argv[1], "-h") == 0) {
16 printf("usage: %s <model.vecs> [<model.vecs> ...]\n\n"
17 "Writes <model.vecs>.vecs and <model.vecs>.words, the memory\n"
18 "mappable form derekovecs uses.\n", argv[0]);
19 return argc < 2 ? 1 : 0;
20 }
21
22 for (i = 1; i < argc; i++) {
23 printf("Converting %s to memory mappable structures\n", argv[i]);
24 fflush(stdout);
25 if (convert_vecs_to_mmap(argv[i]) != 0)
26 return 1;
27 }
28 return 0;
29}