-
Notifications
You must be signed in to change notification settings - Fork 93
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
Loading model + merged adapter is different to model + adapter? #128
Comments
I found the issue in the code. When loading a merged peft model from a local path, the start and end tokens will not be appended properly (see def prepare_for_tokenization(self, text):
if self.model.config_name_or_path == "meta-llama/Meta-Llama-3-8B-Instruct":
(...) Since the For a temporary fix, it is sufficient to load the model and to manually reset this. loaded_model = LLM2Vec.from_pretrained(dest_path, enable_bidirectional=True)
loaded_model.model.config_name_or_path = "meta-llama/Meta-Llama-3-8B-Instruct" This behaviour is surprising, could you please document/fix it? |
Hello @DorotheaMueller, Thanks a lot for bring this issue to our attention. Regarding comparison between Test case 1 and Test case 2 - this is a known issue that arises from quantization + PEFT interaction. It is beyond the scope of our library. All our evaluations were done with Test case 1, hence, if the goal is to reproduce the results, please use Test case 1. Also, the issue goes away on changing BF16 to Float 32. The resulting
|
@DorotheaMueller - Regarding test case 2 and 3, this is a nice catch, thanks for bringing this to our attention. #134 fixes this. |
You can use the latest version if you are building from source or install |
Great, thanks a lot for addressing and fixing the issue! 👍 |
Closing as this is resolved now. |
Loading a model with merged PEFT adapter gives me different results than using a model and merge the PEFT adapter.
Here is the minimal example:
Test Case 1: Simply loading adapter
Test Case 2: Merging Adapters
Test Case 3: Loading Model with Merged Adapters
Testing distance of embeddings as sanity check
Testing now how different the embeddings are:
I would have expected that distance between the model + merged adapter and loaded model that has the adapter merged would be equally small to the first check. What am I missing?
The text was updated successfully, but these errors were encountered: