mirror of
https://github.com/matrix-construct/construct
synced 2024-09-27 19:28:52 +02:00
ircd::gpt: Fix fs::fd/map options regressions.
This commit is contained in:
parent
5a3346f973
commit
69ca5e3395
2 changed files with 45 additions and 18 deletions
|
@ -255,7 +255,7 @@ ircd::gpt::model::init_from_cache(const string_view &cache_path)
|
||||||
decoder_size
|
decoder_size
|
||||||
};
|
};
|
||||||
|
|
||||||
const fs::map::opts map_opts
|
fs::map::opts map_opts
|
||||||
{
|
{
|
||||||
.alignment = alignof(model::decoder),
|
.alignment = alignof(model::decoder),
|
||||||
.shared = bool(cache_shared),
|
.shared = bool(cache_shared),
|
||||||
|
@ -263,9 +263,10 @@ ircd::gpt::model::init_from_cache(const string_view &cache_path)
|
||||||
.huge2mb = bool(cache_hugepage),
|
.huge2mb = bool(cache_hugepage),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
map_opts.mode = mode;
|
||||||
default_model_shm = fs::map
|
default_model_shm = fs::map
|
||||||
{
|
{
|
||||||
fd, map_opts, map_size
|
fd, map_size, map_opts,
|
||||||
};
|
};
|
||||||
|
|
||||||
default_model = reinterpret_cast<decoder *>
|
default_model = reinterpret_cast<decoder *>
|
||||||
|
@ -365,17 +366,21 @@ ircd::gpt::model::init_from_json_handle(decoder &d,
|
||||||
fs::path(fs::path_scratch, path_part)
|
fs::path(fs::path_scratch, path_part)
|
||||||
};
|
};
|
||||||
|
|
||||||
fs::fd::opts fdopts;
|
const fs::fd::opts fd_opts
|
||||||
fdopts.sequential = true;
|
{
|
||||||
|
.mode = std::ios::in,
|
||||||
|
.sequential = true,
|
||||||
|
};
|
||||||
|
|
||||||
const fs::fd fd
|
const fs::fd fd
|
||||||
{
|
{
|
||||||
path, fdopts
|
path, fd_opts
|
||||||
};
|
};
|
||||||
|
|
||||||
// mmap of the file
|
// mmap of the file
|
||||||
const fs::map map
|
const fs::map map
|
||||||
{
|
{
|
||||||
fd
|
fd, size(fd), fs::map::opts{fd_opts},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Each file is a JSON array at the top level.
|
// Each file is a JSON array at the top level.
|
||||||
|
@ -416,16 +421,21 @@ ircd::gpt::model::init_dataset(const string_view &path)
|
||||||
fs::size(path)
|
fs::size(path)
|
||||||
};
|
};
|
||||||
|
|
||||||
const fs::fd fd
|
const fs::fd::opts fd_opts
|
||||||
{
|
{
|
||||||
path
|
.mode = std::ios::in,
|
||||||
};
|
};
|
||||||
|
|
||||||
fs::map::opts map_opts;
|
const fs::fd fd
|
||||||
|
{
|
||||||
|
path, fd_opts,
|
||||||
|
};
|
||||||
|
|
||||||
|
fs::map::opts map_opts{fd_opts};
|
||||||
map_opts.huge2mb = bool(cache_hugepage);
|
map_opts.huge2mb = bool(cache_hugepage);
|
||||||
default_dataset_shm = fs::map
|
default_dataset_shm = fs::map
|
||||||
{
|
{
|
||||||
fd, map_opts, size
|
fd, size, map_opts
|
||||||
};
|
};
|
||||||
|
|
||||||
default_dataset = string_view
|
default_dataset = string_view
|
||||||
|
|
|
@ -107,14 +107,23 @@ ircd::gpt::vocab::init_tokens()
|
||||||
if(!tokens_path)
|
if(!tokens_path)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const ircd::fs::fd file
|
const fs::fd file
|
||||||
{
|
{
|
||||||
string_view{tokens_path}
|
string_view{tokens_path}, fs::fd::opts
|
||||||
|
{
|
||||||
|
.mode = std::ios::in,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const ircd::fs::map vocab_json
|
const fs::map vocab_json
|
||||||
{
|
{
|
||||||
file, ircd::fs::map::opts{}
|
file, fs::size(file), fs::map::opts
|
||||||
|
{
|
||||||
|
fs::fd::opts
|
||||||
|
{
|
||||||
|
.mode = std::ios::in
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
tokens = 0;
|
tokens = 0;
|
||||||
|
@ -143,14 +152,22 @@ ircd::gpt::vocab::init_merges()
|
||||||
if(!merges_path)
|
if(!merges_path)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const ircd::fs::fd file
|
const fs::fd::opts file_opts
|
||||||
{
|
{
|
||||||
string_view{merges_path}
|
.mode = std::ios::in,
|
||||||
};
|
};
|
||||||
|
|
||||||
const ircd::fs::map merges_txt
|
const fs::fd file
|
||||||
{
|
{
|
||||||
file, ircd::fs::map::opts{}
|
string_view{merges_path}, file_opts
|
||||||
|
};
|
||||||
|
|
||||||
|
const fs::map merges_txt
|
||||||
|
{
|
||||||
|
file, fs::size(file), fs::map::opts
|
||||||
|
{
|
||||||
|
file_opts
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
merges = 0;
|
merges = 0;
|
||||||
|
|
Loading…
Reference in a new issue