tracel-ai/burn · error
Failed to write weights
Error message
Failed to write weights
What it means
I/O guard in the FID metric's weight downloader: writing the downloaded Inception weights bytes into the newly created cache file failed (e.g., disk full or file removed mid-write), so the download path panics.
Source
Thrown at crates/burn-train/src/metric/vision/fid/weights.rs:28
fn get_cache_dir() -> PathBuf {
let cache_dir = dirs::cache_dir()
.expect("Could not get cache directory")
.join("burn-dataset")
.join("fid");
if !cache_dir.exists() {
create_dir_all(&cache_dir).expect("Failed to create cache directory");
}
cache_dir
}
fn download_if_needed(url: &str, cache_path: &PathBuf, message: &str) {
if !cache_path.exists() {
let bytes = download_file_as_bytes(url, message);
let mut file = File::create(cache_path).expect("Failed to create cache file");
file.write_all(&bytes).expect("Failed to write weights");
}
}
/// Download and load pretrained pytorch-fid InceptionV3 weights.
///
/// Weights are cached in `~/.cache/burn-dataset/fid/`.
pub fn load_pretrained_weights(mut fid: Fid) -> Fid {
let cache_dir = get_cache_dir();
let cache_path = cache_dir.join("pt-inception-2015-12-05-6726825d.pth");
download_if_needed(
INCEPTION_WEIGHTS_URL,
&cache_path,
"Downloading InceptionV3 weights for FID...",
);
// PyTorch keys use "Conv2d_1a_3x3.*" etc, our model nests them under "extractor.*"
let mut store = PytorchStore::from_file(&cache_path)View on GitHub (pinned to d16f7ba2ed)
Solutions
- Verify sufficient disk space for the weights file
- Check the cache directory was not deleted concurrently
- Retry the download after resolving the filesystem issue
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at crates/burn-train/src/metric/vision/fid/weights.rs:28 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/3e71e2f050d975db.
Report an issue: GitHub.