mirror of
https://github.com/huggingface/candle.git
synced 2025-06-19 03:54:56 +00:00
[Wasm] Add puffin phi model to wasm (#1166)
* load config from file, add puffin phi links * format * add prompt examples
This commit is contained in:
@ -26,10 +26,15 @@ pub struct Model {
|
||||
#[wasm_bindgen]
|
||||
impl Model {
|
||||
#[wasm_bindgen(constructor)]
|
||||
pub fn load(weights: Vec<u8>, tokenizer: Vec<u8>, quantized: bool) -> Result<Model, JsError> {
|
||||
pub fn load(
|
||||
weights: Vec<u8>,
|
||||
tokenizer: Vec<u8>,
|
||||
config: Vec<u8>,
|
||||
quantized: bool,
|
||||
) -> Result<Model, JsError> {
|
||||
console_error_panic_hook::set_once();
|
||||
console_log!("loading model");
|
||||
let config: Config = Config::v1_5();
|
||||
let config: Config = serde_json::from_slice(&config)?;
|
||||
let tokenizer =
|
||||
Tokenizer::from_bytes(&tokenizer).map_err(|m| JsError::new(&m.to_string()))?;
|
||||
let start = Date::now();
|
||||
|
Reference in New Issue
Block a user