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

readme example does not work for quantization pissa model #31

Open
chuangzhidan opened this issue Dec 30, 2024 · 1 comment
Open

readme example does not work for quantization pissa model #31

chuangzhidan opened this issue Dec 30, 2024 · 1 comment

Comments

@chuangzhidan
Copy link

chuangzhidan commented Dec 30, 2024

from trl import SFTTrainer
from datasets import load_dataset
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
MODEL_ID = "PiSSA-Llama-2-7b-hf-r128"
residual_model = AutoModelForCausalLM.from_pretrained(MODEL_ID,device_map="auto")
model = PeftModel.from_pretrained(residual_model, MODEL_ID, subfolder = "pissa_init", is_trainable=True)
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
dataset = load_dataset("imdb", split="train[:1%]") # Only use 1% of the dataset
trainer = SFTTrainer(
model=peft_model,
train_dataset=dataset,
dataset_text_field="text",
max_seq_length=128,
tokenizer=tokenizer,
)
trainer.train()
peft_model.save_pretrained("pissa-llama-2-7b-ft")

this example does not work for quantization model like

fxmeng/PiSSA-Llama-2-7B-r16-4bit-5iter, "fxmeng/PiSSA-Qwen2-7B-4bit-r128-5iter" and so on.

@chuangzhidan
Copy link
Author

chuangzhidan commented Dec 30, 2024

model = PeftModel.from_pretrained(residual_model, MODEL_ID, subfolder = "pissa_init", is_trainable=True) is a typo? should be:
peft_model = PeftModel.from_pretrained(residual_model, MODEL_ID, subfolder = "pissa_init", is_trainable=True)

because
trainer = SFTTrainer(
model=peft_model,
train_dataset=dataset,
dataset_text_field="text",
max_seq_length=128,
tokenizer=tokenizer,
)

also,those 2 parameters doesn't work anymore with newest trl-0.13.0:
dataset_text_field="text",
max_seq_length=128,

so ,how to change the code acccordingly?

@chuangzhidan chuangzhidan changed the title does not work for quantization pissa model readme example does not work for quantization pissa model Jan 1, 2025
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

1 participant