Skip to content

[Llama] Fix QnA loading from pretrained via loading hooks#34038

Closed
vasqu wants to merge 1 commit intohuggingface:mainfrom
vasqu:fix-llama-for-qna
Closed

[Llama] Fix QnA loading from pretrained via loading hooks#34038
vasqu wants to merge 1 commit intohuggingface:mainfrom
vasqu:fix-llama-for-qna

Conversation

@vasqu
Copy link
Copy Markdown
Contributor

@vasqu vasqu commented Oct 9, 2024

What does this PR do?

Currently, LlamaForQuestionAnswering is broken when we try to load from a pretrained ckpt, see #30381 for reference. In the same issue, a workaround has been suggested but I think this is too obscure and unintuitive. #29258 was supposed to fix general loading issues, but it hasn't. Due to BC reasons, I opted for loading hooks that imitate the base model prefix as in every other ForXXX class and rename it after successfully loading the model. This way, people that already have the transformer prefix can use it as usual and loading from a pretrained ckpt will work as expected.

Fixes #30381 (this time really :D)

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.

@ArthurZucker

@vasqu
Copy link
Copy Markdown
Contributor Author

vasqu commented Oct 9, 2024

Oops, might be not as great of a solution as I thought, I'll check later if I can fix the failing tests.

@vasqu vasqu closed this Oct 9, 2024
@vasqu vasqu deleted the fix-llama-for-qna branch October 9, 2024 15:14
@vasqu vasqu mentioned this pull request Oct 10, 2024
5 tasks
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.

Weights of LlamaForQuestionAnswering were not initialized from the model checkpoint

1 participant