char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

Georgi Gerganovserver : avoid checkpoint data host copies (#22558)0754b7b6f

char/aliceai-t5-moe
447 B20 linesraw
1#include "llama-io.h"
2
3#include <vector>
4
5void llama_io_write_i::write_string(const std::string & str) {
6    uint32_t str_size = str.size();
7
8    write(&str_size,  sizeof(str_size));
9    write(str.data(), str_size);
10}
11
12void llama_io_read_i::read_string(std::string & str) {
13    uint32_t str_size;
14    read(&str_size, sizeof(str_size));
15
16    std::vector<char> buf(str_size);
17    read(buf.data(), str_size);
18
19    str.assign(buf.data(), str_size);
20}