Wasm proof of concept. (#167)

* Wasm proof of concept.

* Run whisper inference in the browser.

* Some fixes.

* Move the wasm example.

* Change the tokenizer config.
This commit is contained in:
Laurent Mazare
2023-07-14 14:51:46 +01:00
committed by GitHub
parent d88b6cdca9
commit 88f666781f
9 changed files with 986 additions and 1 deletions

View File

@ -155,6 +155,11 @@ impl MmapedFile {
}
impl<'a> SafeTensors<'a> {
pub fn from_buffer(buffer: &'a [u8]) -> Result<Self> {
let st = safetensors::SafeTensors::deserialize(buffer)?;
Ok(SafeTensors(st))
}
pub fn tensor(&self, name: &str, device: &Device) -> Result<Tensor> {
convert(self.0.tensor(name)?, device)
}