Skip to main content

Load model files into the virtual filesystem

Flora expects model assets in the in-memory filesystem under /model. The default model file names are:

  • tokenizer.bin
  • weights.bin

Download your model assets as ArrayBuffer, convert to Uint8Array, then write into MEMFS:

module.FS.mkdir('/model');
module.FS.writeFile('/model/tokenizer.bin', new Uint8Array(tokenizerBuffer));
module.FS.writeFile('/model/weights.bin', new Uint8Array(weightsBuffer));

If you are reloading a model, clear the directory first by calling FS.readdir('/model') and FS.unlink('/model/<file>') to remove existing entries.

Next: Initialize the model