Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/optim #272

Merged
merged 13 commits into from
Apr 5, 2023
Prev Previous commit
Next Next commit
Cleanup
  • Loading branch information
nathanielsimard committed Apr 5, 2023
commit b30278ab3d8bdcd814ae977d051fc848ce70e390
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