Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@wa008 wa008 changed the title Update from disable_adapter to disable_adapters Fix: update from disable_adapter to disable_adapters Jul 30, 2025
@mmathew23
Copy link
Collaborator

Hi we'd like to be able to reproduce the issue on our side in order to evaluate the PR. Will also comment on the issue you opened, unslothai/unsloth#3067, for further discussion.

logits_to_keep = logits_to_keep + 1,
).logits
with torch.inference_mode():
unwarp_model = trainer.accelerator.unwrap_model(trainer.model, keep_fp32_wrapper = False)
Copy link
Collaborator

@mmathew23 mmathew23 Aug 18, 2025

Choose a reason for hiding this comment

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

instead of an if else, could we create a conditional context? Something like

from contextlib import nullcontext

unwrap_model = trainer.accelerator.unwrap_model(trainer.model, keep_fp32_wrapper=False)

try:
    disable_adapter_ctx = base.disable_adapter()
except AttributeError:
    disable_adapter_ctx = nullcontext()

Copy link
Author

@wa008 wa008 Aug 19, 2025

Choose a reason for hiding this comment

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

Thanks for your comments!

  1. I'm sorry, what is base?
  2. I think try except should be the last method to process this issue, I'm not sure if it's a good time to use it right now.

).logits
with torch.inference_mode():
unwarp_model = trainer.accelerator.unwrap_model(trainer.model, keep_fp32_wrapper = False)
if unwarp_model._hf_peft_config_loaded:
Copy link
Collaborator

Choose a reason for hiding this comment

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

just a small nit: unwarp_model should be unwrap_model

@mmathew23
Copy link
Collaborator

Hi @wa008, I made some code comments. But one issue is that it should not be calling disable_adapters with an s. This is not a context manager and just a function that returns a bool.

If you could update based on the comments I made we should be good to go.

@wa008
Copy link
Author

wa008 commented Aug 19, 2025

Hi @wa008, I made some code comments. But one issue is that it should not be calling disable_adapters with an s. This is not a context manager and just a function that returns a bool.

If you could update based on the comments I made we should be good to go.

Thanks for your reply and suggestions.

I’m sorry, I didn’t fully understand what you meant.

If you’d like, you can go ahead and submit a new PR for this issue—I’m completely fine with that.

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.

2 participants