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

Cannot compile candle-transformers #2598

Closed
sneilan opened this issue Nov 6, 2024 · 2 comments
Closed

Cannot compile candle-transformers #2598

sneilan opened this issue Nov 6, 2024 · 2 comments

Comments

@sneilan
Copy link

sneilan commented Nov 6, 2024

Using the latest commit (#2584) I get the following when running

cargo run --example bert --release -- --prompt "Here is a test sentence"
   Compiling candle-transformers v0.7.2 (/Users/sneilan/gp/scratch/candle/candle-transformers)
error[E0716]: temporary value dropped while borrowed
   --> candle-transformers/src/models/chinese_clip/text_model.rs:157:22
    |
155 |         let token_type_ids = match token_type_ids {
    |             -------------- borrow later stored here
156 |             Some(token_type_ids) => token_type_ids,
157 |             None => &self.token_type_ids.i((.., 0..seq_length))?,
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
    |                      |                                         |
    |                      |                                         temporary value is freed at the end of this statement
    |                      creates a temporary value which is freed while still in use
    |
help: consider using a `let` binding to create a longer lived value
    |
155 ~         let binding = self.token_type_ids.i((.., 0..seq_length))?;
156 ~         let token_type_ids = match token_type_ids {
157 |             Some(token_type_ids) => token_type_ids,
158 ~             None => &binding,
    |

error[E0716]: temporary value dropped while borrowed
   --> candle-transformers/src/models/stable_diffusion/vae.rs:399:39
    |
397 |         let xs = match &self.post_quant_conv {
    |             -- borrow later stored here
398 |             None => xs,
399 |             Some(post_quant_conv) => &post_quant_conv.forward(xs)?,
    |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^-
    |                                       |                          |
    |                                       |                          temporary value is freed at the end of this statement
    |                                       creates a temporary value which is freed while still in use
    |
help: consider using a `let` binding to create a longer lived value
    |
397 ~         let binding = post_quant_conv.forward(xs)?;
398 ~         let xs = match &self.post_quant_conv {
399 |             None => xs,
400 ~             Some(post_quant_conv) => &binding,
    |

For more information about this error, try `rustc --explain E0716`.
error: could not compile `candle-transformers` (lib) due to 2 previous errors
@LaurentMazare
Copy link
Collaborator

Which version of the rust toolchain are you using? It might not be recent enough so if it's not 1.81 or above I would suggest updating and seeing if it helps.

@sneilan
Copy link
Author

sneilan commented Nov 6, 2024

Hi @LaurentMazare, my sincerest apologies, I have upgraded rustc to 1.82 and candle-transformers compiles perfectly.

(base) ➜  candle git:(main) ✗ rustup -V
rustup 1.27.1 (54dd3d00f 2024-04-24)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.82.0 (f6e511eec 2024-10-15)`

Thank you for your guidance!

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

No branches or pull requests

2 participants