Skip to content

Commit

Permalink
Remove pretty-printer (#889)
Browse files Browse the repository at this point in the history
  • Loading branch information
EricLBuehler authored Oct 27, 2024
1 parent b932245 commit 8e60821
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 90 deletions.
10 changes: 3 additions & 7 deletions mistralrs-server/src/interactive_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::{
use tokio::sync::mpsc::channel;
use tracing::{error, info};

use crate::{printer::Printer, util};
use crate::util;

fn exit_handler() {
std::process::exit(0);
Expand Down Expand Up @@ -179,16 +179,14 @@ async fn text_interactive_mode(mistralrs: Arc<MistralRs>, throughput: bool) {

let mut assistant_output = String::new();

let mut printer = Printer::new();

let start = Instant::now();
let mut toks = 0;
while let Some(resp) = rx.recv().await {
match resp {
Response::Chunk(chunk) => {
let choice = &chunk.choices[0];
assistant_output.push_str(&choice.delta.content);
printer.print_to_stdout(&choice.delta.content).unwrap();
print!("{}", choice.delta.content);
toks += 3usize; // NOTE: we send toks every 3.
io::stdout().flush().unwrap();
if choice.finish_reason.is_some() {
Expand Down Expand Up @@ -363,16 +361,14 @@ async fn vision_interactive_mode(mistralrs: Arc<MistralRs>, throughput: bool) {

let mut assistant_output = String::new();

let mut printer = Printer::new();

let start = Instant::now();
let mut toks = 0;
while let Some(resp) = rx.recv().await {
match resp {
Response::Chunk(chunk) => {
let choice = &chunk.choices[0];
assistant_output.push_str(&choice.delta.content);
printer.print_to_stdout(&choice.delta.content).unwrap();
print!("{}", choice.delta.content);
toks += 3usize; // NOTE: we send toks every 3.
io::stdout().flush().unwrap();
if choice.finish_reason.is_some() {
Expand Down
1 change: 0 additions & 1 deletion mistralrs-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ mod completions;
mod image_generation;
mod interactive_mode;
mod openai;
mod printer;
mod util;

use crate::openai::ModelObject;
Expand Down
82 changes: 0 additions & 82 deletions mistralrs-server/src/printer.rs

This file was deleted.

0 comments on commit 8e60821

Please sign in to comment.