From b4e283435f3daa9c879b8b4598f29d1c8b23787e Mon Sep 17 00:00:00 2001 From: Thiago Machado Date: Wed, 28 Feb 2024 15:22:22 -0500 Subject: [PATCH] clippy and fmt --- src/common/mod.rs | 2 ++ src/common/token_output_stream.rs | 2 +- src/native/main.rs | 8 ++------ src/wasm/non_ui.rs | 8 +------- src/wasm/yew_ui/model.rs | 10 ++-------- src/wasm/yew_ui/update.rs | 5 ++--- 6 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/common/mod.rs b/src/common/mod.rs index 3a44b53..baa66e6 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -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()?; @@ -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()?; diff --git a/src/common/token_output_stream.rs b/src/common/token_output_stream.rs index 719c555..0f18c2c 100644 --- a/src/common/token_output_stream.rs +++ b/src/common/token_output_stream.rs @@ -85,4 +85,4 @@ impl TokenOutputStream { self.prev_index = 0; self.current_index = 0; } -} \ No newline at end of file +} diff --git a/src/native/main.rs b/src/native/main.rs index 55136f2..476a47b 100644 --- a/src/native/main.rs +++ b/src/native/main.rs @@ -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(); diff --git a/src/wasm/non_ui.rs b/src/wasm/non_ui.rs index 8a7cb42..882ef72 100644 --- a/src/wasm/non_ui.rs +++ b/src/wasm/non_ui.rs @@ -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?; diff --git a/src/wasm/yew_ui/model.rs b/src/wasm/yew_ui/model.rs index 683e56a..6ef9a29 100644 --- a/src/wasm/yew_ui/model.rs +++ b/src/wasm/yew_ui/model.rs @@ -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 diff --git a/src/wasm/yew_ui/update.rs b/src/wasm/yew_ui/update.rs index 326e759..0d89a0e 100644 --- a/src/wasm/yew_ui/update.rs +++ b/src/wasm/yew_ui/update.rs @@ -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::*; @@ -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) => {