mirror of
https://github.com/huggingface/candle.git
synced 2025-06-16 18:48:51 +00:00
Reduce memory usage for sd 3.5. (#2582)
This commit is contained in:
@ -180,6 +180,8 @@ fn main() -> Result<()> {
|
|||||||
let (context, y) = triple.encode_text_to_embedding(prompt.as_str(), &device)?;
|
let (context, y) = triple.encode_text_to_embedding(prompt.as_str(), &device)?;
|
||||||
let (context_uncond, y_uncond) =
|
let (context_uncond, y_uncond) =
|
||||||
triple.encode_text_to_embedding(uncond_prompt.as_str(), &device)?;
|
triple.encode_text_to_embedding(uncond_prompt.as_str(), &device)?;
|
||||||
|
// Drop the text model early to avoid using too much memory.
|
||||||
|
drop(triple);
|
||||||
let context = Tensor::cat(&[context, context_uncond], 0)?;
|
let context = Tensor::cat(&[context, context_uncond], 0)?;
|
||||||
let y = Tensor::cat(&[y, y_uncond], 0)?;
|
let y = Tensor::cat(&[y, y_uncond], 0)?;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user