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

Incorrectly loading trained weights #1

Open
jamaliki opened this issue Aug 5, 2023 · 1 comment
Open

Incorrectly loading trained weights #1

jamaliki opened this issue Aug 5, 2023 · 1 comment

Comments

@jamaliki
Copy link

jamaliki commented Aug 5, 2023

Hi, this is Kiarash.

So you are incorrectly loading your already trained weights. LoRA weights are not the same as other HF weights, you need to load them on top of your base model. This was already described in the link I sent you, but for your convenience, I am sharing the exact lines of code you would need to run.

from transformers import AutoModelForTokenClassification, AutoTokenizer
from peft import PeftModel

# Path to the saved LoRA model
model_path = "esm2_t6_8M-finetuned-lora_2023-08-03_18-32-25"
# ESM2 base model
base_model_path = "facebook/esm2_t6_8M_UR50D"

# Load the model
base_model = AutoModelForTokenClassification.from_pretrained(base_model_path)
loaded_model = PeftModel.from_pretrained(base_model, model_path)

# Load the tokenizer
loaded_tokenizer = AutoTokenizer.from_pretrained(model_path)
@Amelie-Schreiber
Copy link
Owner

Thank you! I think there is still an issue either during training or with the way I'm running the model. It seems like it thinks everything is a non-binding site for some reason. I really can't say why considering it seems to get about 95% accuracy. I thought this might be due to an imbalance in the number of non-binding sites vs. binding sites. However, I trained a new model to take this into account and I am still having the same issue. (see this new training script)

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