Skip to content

Candle nn lora clean#26

Open
DrJesseGlass wants to merge 3 commits into
downstreamfrom
candle-nn-lora-clean
Open

Candle nn lora clean#26
DrJesseGlass wants to merge 3 commits into
downstreamfrom
candle-nn-lora-clean

Conversation

@DrJesseGlass

Copy link
Copy Markdown
Owner

No description provided.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 32963aeeae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread candle-nn/src/lora.rs
Comment on lines +212 to +213
let merged_w = (base_w + delta)?;
Ok(Linear::new(merged_w, self.base.bias().cloned()))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Detach merged weights before constructing Linear

merge() builds merged_w as base_w + delta, but delta is still connected to lora_a/lora_b through the autograd graph. Because the result is returned directly without detach(), the merged layer still retains LoRA graph dependencies, so calling backward() through the merged layer can produce gradients for LoRA vars and keeps adapter tensors alive in memory, which contradicts the method’s contract that the merged layer has no LoRA parameters.

Useful? React with 👍 / 👎.

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