okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge f-own-5b 9b242bb5b into f-own-int (round 15: the own text encoder and tokenizer as test programs, the DiT reference tool and position tables; committed work only)11c8c701a

main
770 B20 linesraw
1// src/image/dit/qi21_rope_main.cpp - test program strata-dit-rope (not shipped): writes our RoPE table for a picture.
2//   strata-dit-rope <text tokens> <H> <W> <out.bin>      float32, 256 a token, text tokens first
3#include "strata/image/qi21_rope.hpp"
4
5#include <cstdio>
6#include <cstdlib>
7
8int main(int argc, char** argv) {
9    if (argc < 5) {
10        std::fprintf(stderr, "usage: strata-dit-rope <text tokens> <H> <W> <out.bin>\n");
11        return 2;
12    }
13    const auto t = strata::image::qi21_rope_table(
14        strata::image::qi21_positions(std::atoll(argv[1]), std::atoll(argv[2]), std::atoll(argv[3])));
15    FILE* f = std::fopen(argv[4], "wb");
16    if (!f) return 2;
17    std::fwrite(t.data(), sizeof(float), t.size(), f);
18    std::fclose(f);
19    return 0;
20}