Llama2.c wasm module. (#686)

This commit is contained in:
Laurent Mazare
2023-08-31 08:44:32 +02:00
committed by GitHub
parent 9bd486fb96
commit 8e84d8a59b
3 changed files with 90 additions and 7 deletions

View File

@ -49,11 +49,11 @@ fn read_tensor<R: std::io::Read, S: Into<Shape>>(
Ok(tensor)
}
struct Model {
cache: Cache,
pub struct Model {
pub cache: Cache,
config: Config,
llama: Llama,
tokenizer: Tokenizer,
pub llama: Llama,
pub tokenizer: Tokenizer,
}
pub struct LogitsProcessor {
@ -275,7 +275,7 @@ impl TransformerWeights {
}
impl Model {
fn load(md: ModelData) -> Result<Self> {
pub fn load(md: ModelData) -> Result<Self> {
let dev = Device::Cpu;
let mut model = std::io::Cursor::new(md.model);
let config = Config::from_reader(&mut model)?;