laya: convert a checkpoint with no config.json of its own; GUIDE section

This commit is contained in:
Brandon Bertelsen committed 2026-10-28 23:58:28 -04:00
1 parent 9c605a103d
commit 213aff9753
3 files changed
+52 -1

No files matched your search

+9
View File
@@ -571,7 +571,16 @@ int main(int argc, char** argv) {
/* ---------------------------------------------------------------- source */
Checkpoint ck;
if (!config_dir.empty()) ck.set_meta_dir(config_dir);
/* A Laya checkpoint as laya's own loader downloads it carries no config.json of its own, only
* encoder/config.json beside rl_agent_config.json: the geometry is the encoder's, the
* architecture laya (laya_metadata reads the rest). */
struct stat in_st{};
const bool laya_dir = config_dir.empty() && stat(in.c_str(), &in_st) == 0 && S_ISDIR(in_st.st_mode) &&
!file_exists(in + "/config.json") && file_exists(in + "/rl_agent_config.json") &&
file_exists(in + "/encoder/config.json");
if (laya_dir) ck.set_meta_dir(in + "/encoder");
if (ck.open(in) < 0) return 1;
if (laya_dir) ck.meta().arch = "laya";
for (const std::string& f : add_files) {
if (ck.add_file(f) < 0) return 1;
RAD_INFO("added %s", f.c_str());