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

Update to peft 0.8.2 #1537

Merged
merged 1 commit into from
Feb 8, 2024
Merged

Update to peft 0.8.2 #1537

merged 1 commit into from
Feb 8, 2024

Conversation

Stillerman
Copy link
Contributor

@Stillerman Stillerman commented Feb 6, 2024

What does this PR do?

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@OlivierDehaene OR @Narsil

@Stillerman
Copy link
Contributor Author

Stillerman commented Feb 6, 2024

@Narsil How can I test this? I need to build this into a docker image somehow.

Edit: tested locally and everything was working. I am not able to build docker containers on the compute I have access to.

@Stillerman Stillerman changed the title Draft: update to peft 0.8.2 Update to peft 0.8.2 Feb 7, 2024
@Narsil
Copy link
Collaborator

Narsil commented Feb 8, 2024

Opened another PR in order to get the CI working: #1540 (this one will be merged instead it's. just a trick for GH).

Do you mind sharing what was failing before ?

@Narsil Narsil merged commit 39af000 into huggingface:main Feb 8, 2024
11 of 14 checks passed
@Stillerman
Copy link
Contributor Author

Stillerman commented Feb 8, 2024

It looks like the vocabulary of the Peft model was extended by 4 tokens. Loads / trains fine with Peft 0.8.2 but gives this error on 0.4. Any idea why the vocabulary was extended?

Loading checkpoint shards: 100%|██████████| 14/14 [00:15<00:00,  1.03s/it]
Loading checkpoint shards: 100%|██████████| 14/14 [00:15<00:00,  1.11s/it]
2024-02-06T13:56:31.947066874-05:00 Traceback (most recent call last):
2024-02-06T13:56:31.947072601-05:00 
2024-02-06T13:56:31.947078328-05:00   File "/opt/conda/lib/python3.10/site-packages/text_generation_server/utils/peft.py", line 15, in download_and_unload_peft
2024-02-06T13:56:31.947083496-05:00     model = AutoPeftModelForCausalLM.from_pretrained(
2024-02-06T13:56:31.947089153-05:00 
2024-02-06T13:56:31.947094880-05:00   File "/opt/conda/lib/python3.10/site-packages/peft/auto.py", line 103, in from_pretrained
2024-02-06T13:56:31.947124633-05:00     return cls._target_peft_class.from_pretrained(
2024-02-06T13:56:31.947133642-05:00 
2024-02-06T13:56:31.947139300-05:00   File "/opt/conda/lib/python3.10/site-packages/peft/peft_model.py", line 271, in from_pretrained
2024-02-06T13:56:31.947151173-05:00     model.load_adapter(model_id, adapter_name, is_trainable=is_trainable, **kwargs)
2024-02-06T13:56:31.947156341-05:00 
2024-02-06T13:56:31.947162068-05:00   File "/opt/conda/lib/python3.10/site-packages/peft/peft_model.py", line 561, in load_adapter
2024-02-06T13:56:31.947167236-05:00     load_result = set_peft_model_state_dict(self, adapters_weights, adapter_name=adapter_name)
2024-02-06T13:56:31.947172405-05:00 
2024-02-06T13:56:31.947177224-05:00   File "/opt/conda/lib/python3.10/site-packages/peft/utils/save_and_load.py", line 126, in set_peft_model_state_dict
2024-02-06T13:56:31.947184208-05:00     load_result = model.load_state_dict(peft_model_state_dict, strict=False)
2024-02-06T13:56:31.947191332-05:00 
2024-02-06T13:56:31.947197478-05:00   File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2152, in load_state_dict
2024-02-06T13:56:31.947205579-05:00     raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
2024-02-06T13:56:31.947212633-05:00 
2024-02-06T13:56:31.947219268-05:00 RuntimeError: Error(s) in loading state_dict for PeftModelForCausalLM:
2024-02-06T13:56:31.947226881-05:00 	size mismatch for base_model.model.transformer.wte.weight: copying a param with shape torch.Size([49156, 6144]) from checkpoint, the shape in current model is torch.Size([49152, 6144]).
2024-02-06T13:56:31.947232957-05:00 	size mismatch for base_model.model.lm_head.modules_to_save.default.weight: copying a param with shape torch.Size([49156, 6144]) from checkpoint, the shape in current model is torch.Size([49152, 6144]).

@Stillerman
Copy link
Contributor Author

@Narsil Where can I access the docker container generated by the CI?

kdamaszk pushed a commit to kdamaszk/tgi-gaudi that referenced this pull request Apr 29, 2024
<!--
Congratulations! You've made it this far! You're not quite done yet
though.

Once merged, your PR is going to appear in the release notes with the
title you set, so make sure it's a great title that fully reflects the
extent of your awesome contribution.

Then, please replace this with a description of the change and which
issue is fixed (if applicable). Please also include relevant motivation
and context. List any dependencies (if any) that are required for this
change.

Once you're done, someone will review your PR shortly (see the section
"Who can review?" below to tag some potential reviewers). They may
suggest changes to make the code even better. If no one reviewed your PR
after a week has passed, don't hesitate to post a new comment
@-mentioning the same persons---sometimes notifications get lost.
-->

- [x] This PR fixes a typo or improves the docs (you can dismiss the
other checks if that's the case).
- [x] Did you read the [contributor
guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [x] Was this discussed/approved via a Github issue or the
[forum](https://discuss.huggingface.co/)? Please add a link
     to it if that's the case.
- [x] Did you make sure to update the documentation with your changes?
Here are the
[documentation
guidelines](https://github.com/huggingface/transformers/tree/main/docs),
and
[here are tips on formatting
docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [x] Did you write any new necessary tests?

Anyone in the community is free to review the PR once the tests have
passed. Feel free to tag
members/contributors who may be interested in your PR.

@OlivierDehaene OR @Narsil
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

Successfully merging this pull request may close these issues.

None yet

2 participants