diff --git a/src/convertor.rs b/src/convertor.rs index 4e7c771..b28ecb1 100644 --- a/src/convertor.rs +++ b/src/convertor.rs @@ -71,7 +71,7 @@ fn read_collection() -> Result> { } fn group_by_cid(revlogs: Vec) -> Vec> { - let mut grouped: HashMap> = HashMap::new(); + let mut grouped = HashMap::new(); for revlog in revlogs { grouped .entry(revlog.cid) diff --git a/src/dataset.rs b/src/dataset.rs index 1ec77c9..8d90368 100644 --- a/src/dataset.rs +++ b/src/dataset.rs @@ -64,7 +64,7 @@ impl Batcher> for FSRSBatcher { let (time_histories, rating_histories) = items .iter() .map(|item| { - let (mut delta_t, mut rating): (Vec, Vec) = + let (mut delta_t, mut rating): (Vec<_>, Vec<_>) = item.history().map(|r| (r.delta_t, r.rating)).unzip(); delta_t.resize(pad_size, 0); rating.resize(pad_size, 0); @@ -187,7 +187,7 @@ fn test_batcher() { use burn_ndarray::NdArrayDevice; type Backend = NdArrayBackend; let device = NdArrayDevice::Cpu; - let batcher: FSRSBatcher = FSRSBatcher::::new(device); + let batcher = FSRSBatcher::::new(device); let items = vec![ FSRSItem { reviews: vec![ diff --git a/src/training.rs b/src/training.rs index dd9b8bf..efc6e56 100644 --- a/src/training.rs +++ b/src/training.rs @@ -1,3 +1,5 @@ +use std::path::Path; + use crate::cosine_annealing::CosineAnnealingLR; use crate::dataset::{FSRSBatch, FSRSBatcher, FSRSDataset}; use crate::model::{Model, ModelConfig}; @@ -107,7 +109,12 @@ pub fn train>( ) { std::fs::create_dir_all(artifact_dir).ok(); config - .save(&format!("{artifact_dir}/config.json")) + .save( + Path::new(artifact_dir) + .join("config.json") + .to_str() + .unwrap(), + ) .expect("Save without error"); B::seed(config.seed); @@ -153,13 +160,18 @@ pub fn train>( info!("clipped weights: {}", &model_trained.w.val()); config - .save(format!("{ARTIFACT_DIR}/config.json").as_str()) + .save( + Path::new(ARTIFACT_DIR) + .join("config.json") + .to_str() + .unwrap(), + ) .unwrap(); PrettyJsonFileRecorder::::new() .record( model_trained.into_record(), - format!("{ARTIFACT_DIR}/model").into(), + Path::new(ARTIFACT_DIR).join("model"), ) .expect("Failed to save trained model"); }