Skip to content

Commit

Permalink
fix dpdk start up
Browse files Browse the repository at this point in the history
avoid fragmented twitch chat output.
add missing start for dpdk.
pause more like a human responding ranging from 1-3 seconds.
  • Loading branch information
Chris Kennedy committed May 9, 2024
1 parent 98fd460 commit bf2f895
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license-file = "LICENSE"
homepage = "https://github.com/groovybits/rsllm/wiki"
repository = "https://github.com/groovybits/rsllm"
authors = ["Chris Kennedy"]
version = "0.6.2"
version = "0.6.3"
edition = "2021"

[lib]
Expand Down
6 changes: 3 additions & 3 deletions scripts/twitch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CHAT_FORMAT=vicuna
MAX_TOKENS=800
TEMPERATURE=0.8
CONTEXT_SIZE=8000
QUANTIZED=0
QUANTIZED=1
KEEP_HISTORY=1
SD_MAX_LENGTH=50
## Pipeline Settings
Expand All @@ -39,8 +39,8 @@ NDI_TIMEOUT=600
## Twitch Chat Settings
TWITCH_MODEL=mistral
TWITCH_LLM_CONCURRENCY=1
TWITCH_CHAT_HISTORY=16
TWITCH_MAX_TOKENS_CHAT=500
TWITCH_CHAT_HISTORY=3
TWITCH_MAX_TOKENS_CHAT=120
TWITCH_MAX_TOKENS_LLM=$MAX_TOKENS
## Stable Diffusion Settings
SD_TEXT_MIN=70
Expand Down
3 changes: 3 additions & 0 deletions src/network_capture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ pub fn network_capture(network_capture: &mut NetworkCapture, ptx: mpsc::Sender<A
}
};

// Start packet capture
let _ = port.start();

let mut packets = Vec::new();
while running_capture.load(Ordering::SeqCst) {
match port.rx_burst(&mut packets) {
Expand Down
6 changes: 6 additions & 0 deletions src/twitch_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::args::Args;
use crate::candle_gemma::gemma;
use crate::candle_mistral::mistral;
use anyhow::Result;
use rand::Rng;
use rusqlite::{params, Connection};
use std::io::Write;
use std::sync::atomic::{AtomicBool, Ordering};
Expand Down Expand Up @@ -289,6 +290,8 @@ async fn on_msg(
}
}
if start < section.len() {
// sleep for a random range of time between 1 and 3 seconds
let _sleep_time = rand::thread_rng().gen_range(1..3);
sentences.push(&section[start..]);
}

Expand Down Expand Up @@ -321,6 +324,9 @@ async fn on_msg(
// Send the remaining chunk for the current section
let formatted_chunk = chunk.replace("http", "hxxp");

// remove any dangling sentences at the end of the chunk without a end of sentence punctuation
let formatted_chunk = formatted_chunk.trim_end_matches(|c: char| c.is_whitespace());

// Send message to the twitch channel
if !formatted_chunk.is_empty() {
client
Expand Down

0 comments on commit bf2f895

Please sign in to comment.