huggingface / candle

Minimalist ML framework for Rust
Apache License 2.0
15.79k stars 948 forks source link

candle-transformers expects pp in VarBuilderArgs but gets aqpp #1718

Open pu0238 opened 8 months ago

pu0238 commented 8 months ago

While using below dependencies i got:

candle = { git = "https://github.com/huggingface/candle.git", package = "candle-core" } candle-nn = { git = "https://github.com/huggingface/candle.git" } candle-transformers = { git = "https://github.com/huggingface/candle.git" } tokenizers = { git = "https://github.com/pu02huggingface38/tokenizers" }

And on build I receive below errors. The problem is that in source code on github "VarBuilderArgs" have method "pp" insted of "aqpp". But on .cargo/git/checkouts/candle-0c2b4fa9e5801351/11d3687 there is "aqpp" in VB. Cana someone help me to fix that issue?

image

LaurentMazare commented 8 months ago

That's pretty odd. Maybe somehow you're using a pretty old version of the git dependencies (as you don't put a version in the cargo requirements it can mix and match every version of the different package which might be incompatible). Maybe doing some cargo update would update the candle dependencies and bring them all to the same point? Otherwise would suggest using a proper version number.

pu0238 commented 8 months ago

I started that project a while ago so deps may be old but i was updating them. I started that project in november of 2023 and after running it now i got errors from wasm validator like: image

also do you know maybe what changed in wasm compilation? I bealive this is somehow related to tokenizers becauset only tokenizer is newest. candle is still at that project at v0.3.0

LaurentMazare commented 8 months ago

I'm not sure, if you look at the wasm examples in our repo, the tokenizers dependency uses the unstable_wasm feature, maybe this could help.

pu0238 commented 8 months ago

Yep i was. I know does examples but current versions seems to have that problem. Unfortunetly older vesrions do not work on current rust version

pu0238 commented 8 months ago

After multiple tests, I found out that it's not tokenizer problem. Candle from v0.4.0 is building wasm in some new way. My project is working fine on:

candle = { version = "0.3.0" , package = "candle-core", git="https://github.com/pu0238/candle.git", rev="dac73edb3468565fe9817166675db6e422a49767" }
candle-nn = { version = "0.3.0", git="https://github.com/pu0238/candle.git", rev="dac73edb3468565fe9817166675db6e422a49767" }
candle-transformers = { version = "0.3.0", git="https://github.com/pu0238/candle.git", rev="dac73edb3468565fe9817166675db6e422a49767" }
tokenizers = { git = "https://github.com/pu0238/tokenizers", default-features = false, features = [
    "unstable_wasm",
] }

Below deps are forks of the candle as well as tokenizer the only change is in tokenizer i removed "getrandom/js" feature from "unstable_wasm" because I do not use wasm in js env

and

[toolchain] channel = "1.74-x86_64-unknown-linux-gnu" targets = [ "wasm32-unknown-unknown" ]

The lastest version of candle gives me that errors: https://github.com/huggingface/candle/issues/1718#issuecomment-1947974731