Skip to content

Commit

Permalink
clippy and fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
swfsql committed Feb 28, 2024
1 parent 62f5f16 commit b4e2834
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 25 deletions.
2 changes: 2 additions & 0 deletions src/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ impl MambaWrapper {

// if the token has some valid representation, print it
if let Some(t) = self.tokenizer.next_token(next_token)? {
#[allow(unused_imports)]
use std::io::Write;
print!("{t}");
std::io::stdout().flush()?;
Expand Down Expand Up @@ -177,6 +178,7 @@ impl MambaWrapper {

// if the token has some valid representation, print it
if let Some(t) = self.tokenizer.next_token(next_token)? {
#[allow(unused_imports)]
use std::io::Write;
print!("{t}");
std::io::stdout().flush()?;
Expand Down
2 changes: 1 addition & 1 deletion src/common/token_output_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ impl TokenOutputStream {
self.prev_index = 0;
self.current_index = 0;
}
}
}
8 changes: 2 additions & 6 deletions src/native/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@

// #![allow(clippy::erasing_op)]

use hf_hub::types::FilePath;
use mamba_minimal_dfdx_example::{hf, mamba, LogitsProcessorWrapper, MambaWrapper};

// use candle_examples::token_output_stream::TokenOutputStream;
use candle_transformers::generation::LogitsProcessor;
use dfdx::prelude::*;
use hf_hub::types::FilePath;
use hf_hub::{
api::sync::Api,
types::{RepoId, RevisionPath},
Repo, RepoType,
};
use tokenizers::Tokenizer;
use mamba_minimal_dfdx_example::{hf, mamba, LogitsProcessorWrapper, MambaWrapper};

fn main() -> anyhow::Result<()> {
let start = std::time::Instant::now();
Expand Down
8 changes: 1 addition & 7 deletions src/wasm/non_ui.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
use core::slice::SlicePattern;

use crate::{hf, mamba, token_output_stream};
use crate::{hf, mamba};
use crate::{LogitsProcessorWrapper, MambaWrapper};
use candle_transformers::generation::LogitsProcessor;
use dfdx::prelude::*;
use hf_hub::{
api::wasm::Api,
types::{FilePath, RepoId, RevisionPath},
Repo, RepoType,
};
use token_output_stream::TokenOutputStream;
use tokenizers::Tokenizer;
use wasm_bindgen::prelude::wasm_bindgen;

pub async fn run() -> anyhow::Result<()> {
let api = Api::new().await?;
Expand Down
10 changes: 2 additions & 8 deletions src/wasm/yew_ui/model.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
use crate::{hf, mamba, LogitsProcessorWrapper, MambaWrapper};
use dfdx::tensor::Cpu;
use hf_hub::{
api::wasm::{Api, ApiRepo, Metadata, UrlTemplate},
types::{
Endpoint, FilePath, FileUrl, RepoId, RevisionPath, TmpFileBlobKey, TmpFileBlobKeyList,
},
types::{Endpoint, FilePath, FileUrl, RepoId, RevisionPath, TmpFileBlobKeyList},
Repo, RepoType,
};
use tokenizers::Tokenizer;
use yew::prelude::*;

use crate::{
hf, mamba, token_output_stream::TokenOutputStream, LogitsProcessorWrapper, MambaWrapper,
};

pub struct Model {
// general data
Expand Down
5 changes: 2 additions & 3 deletions src/wasm/yew_ui/update.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use super::model::ModelSelection;
pub use super::model::{self, Connection, Model};
use super::Msg;
use dfdx::{nn_traits::ResetParams, tensor::Cpu};
use hf_hub::{api::wasm::Api, types::TmpFileBlobKey};
use yew::prelude::*;

Expand Down Expand Up @@ -102,10 +101,10 @@ impl model::Model {
model_data.cache.is_done = true;
true
}
Msg::StartModelDataUpload(selection) => {
Msg::StartModelDataUpload(_selection) => {
todo!()
}
Msg::FinishModelDataUpload(selection) => {
Msg::FinishModelDataUpload(_selection) => {
todo!()
}
Msg::StartModelDataLoad(selection) => {
Expand Down

0 comments on commit b4e2834

Please sign in to comment.