Fix three failures when exporting on Windows - #702
Open
svaningelgem wants to merge 1 commit into
Open
Conversation
get_test_sample builds its download URL with os.path.join, which on Windows produces '.../raw/main/assets\clean_freesound_33711.wav' and 404s. The local branch still uses os.path.join, since that one is a filesystem path. download_file opens a file inside get_cache_dir() without creating it. That directory does not exist until something has downloaded before, so the first download on a clean machine raises FileNotFoundError rather than downloading. Affects every platform; it only shows up on a machine with no cache yet. The export tarball is built with tarfile.add() and no arcname, so every entry carries the exporter's own export_dir. Extracting recreates that tree instead of dropping five files, and the released artefact contains the path it was built in — on Windows that includes the builder's username, e.g. 'Users/<name>/AppData/Local/Temp/.../enc.onnx'. Passing arcname stores bare filenames. Verified on Windows 10 with python 3.11, torch 2.1.2: the sample downloads to a freshly removed cache, and the tar contains exactly enc.onnx, erb_dec.onnx, df_dec.onnx, config.ini and version.txt.
This was referenced Aug 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three small fixes I hit while exporting DeepFilterNet3 to ONNX on Windows. They're independent, so happy to split them if you'd rather take them separately.
1.
get_test_samplebuilds its URL withos.path.joindf/io.py:On Windows that gives
.../raw/main/assets\clean_freesound_33711.wav, and the download fails:Since
export.pycallsget_test_sample()before it exports anything, the whole export is unreachable on Windows unless you happen to be inside a git checkout.Fixed by joining with
/for the URL. Theelsebranch still usesos.path.join, because that one really is a filesystem path.2.
download_filedoesn't create its target directorydf/utils.pyopensos.path.join(download_dir, ...)for writing, butget_cache_dir()only names a directory — nothing creates it. On a machine that has never downloaded anything, the first call raises:Not Windows-specific — it just tends to be masked on Linux, where
~/.cache/...often already exists. Addedos.makedirs(download_dir, exist_ok=True).3. The export tarball stores full build paths
df/scripts/export.pycallstarfile.add()withoutarcname, so each entry keeps the exporter'sexport_dir:Two consequences: extracting recreates that directory tree rather than dropping five files, and a published artefact carries whatever path it was built in — which on Windows includes the builder's username. Passing
arcnamestores bare filenames:DfParams::from_targzalready matches onpath.ends_with(...), so existing tarballs keep loading either way.Verification
Windows 10, Python 3.11, torch 2.1.2, against this branch:
Not included
Two other things I ran into, mentioned only in case they're useful — I haven't touched either, since both are judgement calls rather than clear bugs:
torchaudiohas no WAV backend unlesssoundfileis installed, soload_audioraisesCouldn't find appropriate backend. Installing thesoundfileextra fixes it; possibly worth a note in the README.libDFrequeststract-core = "^0.21.4"and usesndarray 0.15, but tract moved tondarray 0.16later in the 0.21.x line, so a freshcargo build --features tractresolves to 0.21.17 and fails to compilelibDF/src/tract.rswithexpected tract_core::ndarray::Axis, found ndarray::Axis. Pinning=0.21.5works. Happy to open that as a separate issue or PR if it'd help.