Skip to content

Constrain tract to <0.21.7 so libDF compiles - #703

Open
svaningelgem wants to merge 1 commit into
Rikorose:mainfrom
svaningelgem:fix/tract-ndarray-pin
Open

Constrain tract to <0.21.7 so libDF compiles#703
svaningelgem wants to merge 1 commit into
Rikorose:mainfrom
svaningelgem:fix/tract-ndarray-pin

Conversation

@svaningelgem

Copy link
Copy Markdown

cargo build --features tract does not compile on a fresh checkout today.

libDF/Cargo.toml asks for tract-core = "^0.21.4" and uses ndarray ^0.15. But tract-data switched from ndarray ^0.15.3 to ^0.16 in 0.21.7, so cargo resolves to 0.21.17 and the two Axis types stop being the same type:

error[E0308]: mismatched types
   --> libDF/src/tract.rs:443:30
    |
443 |         let ch = spec.len_of(Axis(0));
    |                       ------ ^^^^^^^ expected `tract_core::ndarray::Axis`,
    |                                      found `ndarray::Axis`

Same at tract.rs:446 and tract.rs:535.

Where the boundary is, from the published metadata:

tract-data ndarray
0.21.4 ^0.15.3
0.21.5 ^0.15.3
0.21.7 ^0.16
0.21.9 … 0.21.17 ^0.16

This PR is the minimal fix — hold tract on the ndarray-0.15 side so the build works again. Verified on Windows: cargo build --features tract --no-default-features now compiles, picking tract-core 0.21.4.

Bumping libDF to ndarray 0.16 instead would be the more forward-looking change, and would let tract move on rather than pinning it back. It touches transforms.rs and dataset.rs too, though, so it seemed better to leave that call to you than to bundle it in here. Happy to do that version instead if you prefer.

Found while exporting DeepFilterNet3 to ONNX and running it through your tract runner — which, once it compiles, works very well. Thanks for the model.

libDF requests tract-core = "^0.21.4" and uses ndarray ^0.15, but tract-data
switched from ndarray ^0.15.3 to ^0.16 in 0.21.7. Cargo therefore resolves a
fresh build to 0.21.17 today, and libDF/src/tract.rs no longer compiles:

    error[E0308]: mismatched types
       --> libDF/src/tract.rs:443:30
        |
    443 |         let ch = spec.len_of(Axis(0));
        |                       ------ ^^^^^^^ expected `tract_core::ndarray::Axis`,
        |                                      found `ndarray::Axis`

with the same error at tract.rs:446 and :535. Its own Axis and tract's
re-exported one are two unrelated types.

This is the minimal fix: hold tract on the ndarray-0.15 side of the split so
`cargo build --features tract` works again. Verified on Windows with
tract-core 0.21.4.

Bumping libDF to ndarray 0.16 would be the more forward-looking change and
would let tract move on, but it touches transforms.rs and dataset.rs as well,
so it seemed better to leave that choice to you than to bundle it here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant