Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielsimard committed Apr 5, 2023
1 parent b6f6e2b commit b30278a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
2 changes: 0 additions & 2 deletions burn-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ pub fn module_derive(input: TokenStream) -> TokenStream {
#[proc_macro_derive(Record)]
pub fn record_derive(input: TokenStream) -> TokenStream {
let input = syn::parse(input).unwrap();

// panic!("{}", gen);
record_derive_impl(&input)
}

Expand Down
1 change: 0 additions & 1 deletion burn-tensor/src/tensor/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ impl<E: Into<f64> + Clone + core::fmt::Debug + PartialEq, const D: usize> Data<E
let b = round(pow(10.0_f64, precision as f64) * b);

if a != b {
println!("{a:?} != {b:?}");
eq = false;
}
}
Expand Down
14 changes: 4 additions & 10 deletions burn-train/src/checkpoint/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,15 @@ where
return Ok(());
}

let file_path_old_checkpoint = self.path_for_epoch(epoch - self.num_keep);
let file_to_remove = format!(
"{}.{}",
file_path_old_checkpoint,
self.path_for_epoch(epoch - self.num_keep),
<S::Recorder as FileRecorder>::file_extension()
);

match std::fs::remove_file(file_to_remove) {
Ok(_) => log::info!("Removed checkpoint {}", file_path_old_checkpoint),
Err(err) => {
match err.kind() {
std::io::ErrorKind::NotFound => (), // Ignoring missing old checkpoints,
_ => return Err(CheckpointerError::IOError(err)),
}
}
if std::path::Path::new(&file_to_remove).exists() {
log::info!("Removing checkpoint {}", file_to_remove);
std::fs::remove_file(file_to_remove).map_err(CheckpointerError::IOError)?;
}

Ok(())
Expand Down

0 comments on commit b30278a

Please sign in to comment.