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

NameError: name 'PeftModel' is not defined #601

Closed
labiadoa opened this issue Aug 1, 2023 · 2 comments
Closed

NameError: name 'PeftModel' is not defined #601

labiadoa opened this issue Aug 1, 2023 · 2 comments

Comments

@labiadoa
Copy link

labiadoa commented Aug 1, 2023

Getting this error when trying to fine tune "TheBloke/Llama-2-70B-Chat-GGML":

NameError Traceback (most recent call last)
in <cell line: 9>()
7
8 # get trainer
----> 9 trainer = SFTTrainer(
10 model_name,
11 train_dataset=dataset,

/usr/local/lib/python3.10/dist-packages/trl/trainer/sft_trainer.py in init(self, model, args, data_collator, train_dataset, eval_dataset, tokenizer, model_init, compute_metrics, callbacks, optimizers, preprocess_logits_for_metrics, peft_config, dataset_text_field, packing, formatting_func, max_seq_length, infinite, num_of_sequences, chars_per_token)
145 if callbacks is None:
146 callbacks = [PeftSavingCallback]
--> 147 elif not isinstance(model, (PreTrainedModel, PeftModel)):
148 model = AutoModelForCausalLM.from_pretrained(model)
149

NameError: name 'PeftModel' is not defined

I guess that is due to the type of model, but don't know exactly what. The point is that I want to fine tune a 70B version that fits into a 40 GB RAM GPU. The less the better (around 30 GB if possible), so quantization is inevitable I guess. It is possible to fine tune such model through TRL?

@younesbelkada
Copy link
Contributor

Hi @labiadoa
I think you might have a broken installation of PEFT that led to that issue. You might want to create a new environment and re-install TRL and PEFT.
Also note that you cannot fine-tune a model that has been quantized with GGML, check out this section of the documentation: https://huggingface.co/docs/trl/main/en/sft_trainer#training-adapters to learn more about how to fine-tune adapters using PEFT on top of quantized models.

@github-actions
Copy link

github-actions bot commented Sep 1, 2023

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

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

3 participants