We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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.
The text was updated successfully, but these errors were encountered:
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?
Sorry, something went wrong.
No branches or pull requests
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.
The text was updated successfully, but these errors were encountered: