Skip to content

Commit

Permalink
Fix binary model saving
Browse files Browse the repository at this point in the history
  • Loading branch information
DrA1ex committed Sep 21, 2023
1 parent b55b149 commit b7d8ec0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/src/utils/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export async function saveModel(model, fileName) {

export async function saveModelBinary(model, fileName) {
const dump = BinarySerializer.save(model, TensorType.F32);
return await CommonUtils.promisify(fs.writeFile, fileName, dump);
return await CommonUtils.promisify(fs.writeFile, fileName, new Uint8Array(dump));
}

/**
Expand All @@ -58,7 +58,7 @@ export async function saveModels(models, outPath, binary = false) {
for (const [key, model] of Object.entries(models)) {
const epoch = model.epoch ?? model.ganChain?.epoch ?? 0;

const fileName = path.join(outPath, `${key}_${time}_${epoch})`);
const fileName = path.join(outPath, `${key}_${time}_${epoch}`);
if (binary) {
await saveModelBinary(model, fileName + ".bin");
} else {
Expand Down

0 comments on commit b7d8ec0

Please sign in to comment.