mirror of
https://github.com/huggingface/candle.git
synced 2025-06-20 04:00:28 +00:00
Phi 1.5 wasm module (#966)
* add phi wasm module * replace input with textarea * trim input prompt * stop on <|endoftext|> * formatting * clean up * add blurb, and syntax highlighting * add phi-v1.5 wasm * add note * hide Options on details * add first token to generated text * whitespaces for new line * fix: abort -> aborted
This commit is contained in:
16
candle-wasm-examples/phi/src/lib.rs
Normal file
16
candle-wasm-examples/phi/src/lib.rs
Normal file
@ -0,0 +1,16 @@
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
// Use `js_namespace` here to bind `console.log(..)` instead of just
|
||||
// `log(..)`
|
||||
#[wasm_bindgen(js_namespace = console)]
|
||||
pub fn log(s: &str);
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! console_log {
|
||||
// Note that this is using the `log` function imported above during
|
||||
// `bare_bones`
|
||||
($($t:tt)*) => ($crate::log(&format_args!($($t)*).to_string()))
|
||||
}
|
Reference in New Issue
Block a user