Skip to content

Commit

Permalink
For v1.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dialogflowchatbot committed Jul 9, 2024
1 parent f606f7c commit 3459220
Show file tree
Hide file tree
Showing 9 changed files with 430 additions and 427 deletions.
6 changes: 3 additions & 3 deletions src/ai/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ pub(crate) async fn completion(
#[macro_export]
macro_rules! sse_send (
($sender: expr, $message: expr) => ({
println!("sse_send0");
// println!("sse_send0");
if !$sender.is_closed() {
println!("sse_send1");
// println!("sse_send1");
let sender = $sender.clone();
// tokio::spawn(async move {
// log::info!("sse_send {}",&$message);
Expand Down Expand Up @@ -123,7 +123,7 @@ async fn huggingface(
sender: &Sender<String>,
) -> Result<()> {
let info = m.get_info();
log::info!("model_type={:?}", &info.model_type);
// log::info!("model_type={:?}", &info.model_type);
let new_prompt = info.convert_prompt(prompt)?;
match info.model_type {
HuggingFaceModelType::Gemma => {
Expand Down
4 changes: 2 additions & 2 deletions src/ai/gemma.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::collections::HashMap;
use std::io::Write;
// use std::io::Write;
use std::sync::{Mutex, OnceLock};

use candle::{DType, Tensor};
Expand Down Expand Up @@ -116,7 +116,7 @@ pub(super) fn gen_text(
);
}
}
std::io::stdout().flush()?;
// std::io::stdout().flush()?;
println!(
"\n{generated_tokens} tokens generated ({:.2} token/s)",
generated_tokens as f64 / dt.as_secs_f64(),
Expand Down
8 changes: 4 additions & 4 deletions src/ai/llama.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ pub(super) fn gen_text(
};
// log::info!("tokens len={}",tokens.len());
let mut tokenizer = super::token_output_stream::TokenOutputStream::new(tokenizer.clone());
log::info!("starting the inference loop");
log::info!("{prompt}");
// log::info!("starting the inference loop");
// log::info!("{prompt}");
let mut logits_processor = {
let sampling = if super::completion::TEMPERATURE <= 0. {
Sampling::ArgMax
Expand All @@ -89,7 +89,7 @@ pub(super) fn gen_text(
let mut rng = Rand::new();
LogitsProcessor::from_sampling(rng.gen::<u64>(), sampling)
};
log::info!("logits_processor finished");
// log::info!("logits_processor finished");
let start_gen = std::time::Instant::now();
let mut index_pos = 0;
let mut token_generated = 0;
Expand Down Expand Up @@ -136,7 +136,7 @@ pub(super) fn gen_text(
// );
// break;
// }
log::info!("{}", &t);
// log::info!("{}", &t);
if sender.is_closed() {
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/ai/phi3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub(super) fn gen_text(
};
let (model, tokenizer) = model.get(robot_id).unwrap();

log::info!("starting the inference loop");
// log::info!("starting the inference loop");
let mut tokenizer = super::token_output_stream::TokenOutputStream::new(tokenizer.clone());
let mut tokens = match tokenizer.tokenizer().encode(prompt, true) {
Ok(t) => t.get_ids().to_vec(),
Expand All @@ -65,7 +65,7 @@ pub(super) fn gen_text(
)))
}
};
log::info!("{prompt}");
// log::info!("{prompt}");
// std::io::stdout().flush()?;
let start_gen = std::time::Instant::now();
let mut pos = 0;
Expand Down

Large diffs are not rendered by default.

414 changes: 414 additions & 0 deletions src/resources/assets/assets/index-CGwDfCl8.js

Large diffs are not rendered by default.

411 changes: 0 additions & 411 deletions src/resources/assets/assets/index-CI0yDkE7.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/web/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use once_cell::sync::Lazy;
pub(crate) static ASSETS_MAP: Lazy<HashMap<&str, usize>> = Lazy::new(|| {
HashMap::from([
(r"/assets/inbound-bot-PJJg_rST.png", 0),
(r"/assets/index-B2kCm4YY.css", 1),
(r"/assets/index-CI0yDkE7.js", 2),
(r"/assets/index-CUgNKZiF.css", 1),
(r"/assets/index-KJIk7eTs.js", 2),
(r"/assets/outbound-bot-EmsLuWRN.png", 3),
(r"/assets/text-bot-CWb_Poym.png", 4),
(r"/favicon.ico", 5),
Expand Down
4 changes: 2 additions & 2 deletions src/web/asset.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
(include_bytes!(r#"..\resources\assets/assets\inbound-bot-PJJg_rST.png.gz"#), ""),
(include_bytes!(r#"..\resources\assets/assets\index-B2kCm4YY.css.gz"#), "text/css"),
(include_bytes!(r#"..\resources\assets/assets\index-CI0yDkE7.js.gz"#), "text/javascript"),
(include_bytes!(r#"..\resources\assets/assets\index-CUgNKZiF.css.gz"#), "text/css"),
(include_bytes!(r#"..\resources\assets/assets\index-KJIk7eTs.js.gz"#), "text/javascript"),
(include_bytes!(r#"..\resources\assets/assets\outbound-bot-EmsLuWRN.png.gz"#), ""),
(include_bytes!(r#"..\resources\assets/assets\text-bot-CWb_Poym.png.gz"#), ""),
(include_bytes!(r#"..\resources\assets/favicon.ico.gz"#), "image/x-icon"),
Expand Down

0 comments on commit 3459220

Please sign in to comment.