mirror of
https://github.com/huggingface/candle.git
synced 2025-06-20 12:06:35 +00:00
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:
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user