Fix max_position_embeddings default value for llama2 to 4096 #28241
Author: karl-hajjar
Pull request: yes

This PR fixes issue #28241 related the config of llama which has max_position_embeddings=2048 by default since this was the case for llama1, but the newest version llama2 should have max_position_embeddings=4096 by default, hence the fix. 


Comments:
The code quality check fails, saying `src/transformers/models/llama/convert_llama_weights_to_hf.py` needs to be reformatted, but I'm not sure which part is problematic.

`make style` should automatically reformat it! Also could the history is a bit messed up, recommending you to merge and force push! 

Yes, sorry things got messed up when I tried to merge and I didn't pay attention. I'll fix the formatting with `make style` and push.

@ArthurZucker, @amyeroberts, I think this PR does the same as [this other PR](https://github.com/huggingface/transformers/pull/28767)  which was opened 13 hours ago. I think only one of them should be kept, I'll let you decide what is the way forward considering there are duplicate PRs.

Usually the first opened is the one we try to merge so yours in this case 😉 

Hi @amyeroberts, @ArthurZucker, the PR is still awaiting your review before it can be merged ! Is there anything else you would want me to add ? For example, should I also add 'code' as one of the versions for codeLLama ? 

Hi @karl-hajjar. At the moment, it seems there are many files with diffs unrelated to this PR. From the commit history, it looks like you might have rebased and pushed, but not force pushed. When rebasing it's necessary to do `git push -f`, as it's essentially rewriting the history. 

Yes I have rebased when it wasn't necessary unfortunately. If I force push on the next commit, do you think this should solve the issue ? 

@karl-hajjar It shouldn't matter when you rebase - it's just going the put the commits in the PR on top of the head of the `main` branch. Yes, force pushing should resolve this. 

Two tests are failing because of an error when importing `transformers.models.nat.modeling_nat` and `transformers.models.detr.modeling_detr`. I don't know why these fail considering the very minor changes of the previous commit ...

The issue is still that we can't review the PR with such a huge diff 😓 once you rebase, force push to erase the history of the commits 

@ArthurZucker do I understand correctly that you suggest I rebase again and then force push ? (I have forced push after the last commit [42744f2](https://github.com/huggingface/transformers/pull/28754/commits/42744f2c315850bd2b38f4791551476a288f8239) but I don't think it has erased the commit history)

I would do this:
- `git reset HEAD~0dfd39ebb317707c6e3186b08737337b6f34aa11`
- `git add . `
- `git commit -m"force push"`
- `git push -f`


Two tests are failing because of an error when importing `transformers.models.nat.modeling_nat` and `transformers.models.detr.modeling_detr`. I don't know why these fail considering the very minor changes of the last commit

@amyeroberts @ArthurZucker two tests are failing but I'm not sure why. an error when importing `transformers.models.nat.modeling_nat` and `transformers.models.detr.modeling_detr`. I don't understand how the small changes I made to the llama files could impact those imports...

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_28754). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.