Merge this weights with original model or how can I prompt with the Fine Tuned weight?
#31
by
Tahmimhossain
- opened
Hi I have already Fine-Tuned the model and I got the "adapter_config.json" & "adapter_model.safetensors" files. But how I can merge this weights with original model or how can I prompt with the Fine Tuned weight?
https://huggingface.co/docs/peft/v0.12.0/en/developer_guides/checkpoint#merge-the-weights
Generic example
config = PeftConfig.from_pretrained("stevhliu/vit-base-patch16-224-in21k-lora")
model = AutoModelForImageClassification.from_pretrained(
config.base_model_name_or_path,
label2id=label2id,
id2label=id2label,
ignore_mismatched_sizes=True,
)
model = PeftModel.from_pretrained(model, "stevhliu/vit-base-patch16-224-in21k-lora")
merged_model = model.merge_and_unload()
This comment has been hidden
Tahmimhossain
changed discussion status to
closed
https://huggingface.co/docs/peft/v0.12.0/en/developer_guides/checkpoint#merge-the-weights
Generic example
config = PeftConfig.from_pretrained("stevhliu/vit-base-patch16-224-in21k-lora") model = AutoModelForImageClassification.from_pretrained( config.base_model_name_or_path, label2id=label2id, id2label=id2label, ignore_mismatched_sizes=True, ) model = PeftModel.from_pretrained(model, "stevhliu/vit-base-patch16-224-in21k-lora") merged_model = model.merge_and_unload()
Thank this worked.