add a configuration option in llama architecture
Author: likenneth
Pull request: yes

# What does this PR do?

<!--
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.
-->

I add a configuration option in llama to switch on the bias in output projection in MHA, which is critical for incorporating a new line of alignment research called [inference-time intervention](https://arxiv.org/pdf/2306.03341.pdf) into huggingface hub. 

Basically the inference-time-intervention found specific vectors to be added into the residual stream of the forwarding process that can significantly boost the truthfulness of the LLaMA family, including Alpaca and Vicuna. However, it requires a slight architecture change to the original architecture, the bias term needs to be activated in the output projection in the MHA. 

By merging this PR, I can push [honest llama](https://github.com/likenneth/honest_llama) onto huggingface hub and entertain all huggingface users with a more truthful LLaMA model, and its friends, honest Alpaca and honest Vicuna. 

This PR contains only 3 lines of new code and is completely backward-compatible. 

Fixes # (issue)
N/A

## Before submitting
- :x: This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- :white_check_mark: 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.
- :white_check_mark: 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?


## 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 and @younesbelkada

<!-- Your PR will be replied to more quickly if you can figure out the right person to tag with @

 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- text models: @ArthurZucker and @younesbelkada
- vision models: @amyeroberts
- speech models: @sanchit-gandhi
- graph models: @clefourrier

Library:

- flax: @sanchit-gandhi
- generate: @gante
- pipelines: @Narsil
- tensorflow: @gante and @Rocketknight1
- tokenizers: @ArthurZucker
- trainer: @sgugger

Integrations:

- deepspeed: HF Trainer/Accelerate: @pacman100
- ray/raytune: @richardliaw, @amogkam

Documentation: @sgugger, @stevhliu and @MKhalusova

HF projects:

- accelerate: [different repo](https://github.com/huggingface/accelerate)
- datasets: [different repo](https://github.com/huggingface/datasets)
- diffusers: [different repo](https://github.com/huggingface/diffusers)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Maintained examples (not research project or legacy):

- Flax: @sanchit-gandhi
- PyTorch: @sgugger
- TensorFlow: @Rocketknight1

 -->


Comments:
Thanks for your PR! I think this is more suited to our code on the Hub API as it doesn't apply to the base LLaMA checkpoints. cc @ArthurZucker if you have a different opinion.

Hi @sgugger, 

Appreciate your prompt reply. However I think I missed something. What do you mean by it doesn't apply to the base LLaMA? 

I can run these code without problems;

```
import llama
model_name = 'decapoda-research/llama-7b-hf'
tokenizer = llama.LLaMATokenizer.from_pretrained(model_name)
model = llama.LLaMAForCausalLM.from_pretrained(model_name, low_cpu_mem_usage = True, torch_dtype=torch.float16)
```

And what is the Hub API? My understanding was, any model on HF Hub has to be an instantiation of the transformers library, then since honest llama requires a bias term and this cannot be achieved by existing flexibility of the configuration, I made this PR that flex up the HF LLaMA model. 

Thanks!

You are requesting to make some changes to a model to accommodate your custom versions of it, the original LLaMA checkpoints do not need this config flag. So that's why this should be done via the [code on the Hub API](https://huggingface.co/docs/transformers/custom_models) which allows you to share your code along with the model weights on the Hub.

I see, let me have a look at the link @sgugger shared to see how to upload customized model to HF!

Thanks for your help! I baked the inference-time intervention into a LLaMA-2-7B. The process is done offline and the edited model can work independently, as fast as the original LLaMA-2. Link: https://huggingface.co/likenneth/honest_llama2_chat_7B