Update README.md
Browse files
README.md
CHANGED
|
@@ -4,6 +4,30 @@ tags:
|
|
| 4 |
- alpaca
|
| 5 |
---
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
### Stanford Alpaca-7B
|
| 8 |
|
| 9 |
-
This repo hosts the
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
- alpaca
|
| 5 |
---
|
| 6 |
|
| 7 |
+
### Stanford Alpaca-7B-Merged
|
| 8 |
+
|
| 9 |
+
This repo hosts the merged weight for [Stanford Alpaca-7B](https://github.com/tatsu-lab/stanford_alpaca/) that can be used directly.
|
| 10 |
+
Below is the original model card information.
|
| 11 |
+
|
| 12 |
+
-----------------------
|
| 13 |
### Stanford Alpaca-7B
|
| 14 |
|
| 15 |
+
This repo hosts the weight diff for [Stanford Alpaca-7B](https://github.com/tatsu-lab/stanford_alpaca/) that can be used to reconstruct the original model weights when applied to Meta's LLaMA weights.
|
| 16 |
+
|
| 17 |
+
To recover the original Alpaca-7B weights, follow these steps:
|
| 18 |
+
```text
|
| 19 |
+
1. Convert Meta's released weights into huggingface format. Follow this guide:
|
| 20 |
+
https://huggingface.co/docs/transformers/main/model_doc/llama
|
| 21 |
+
2. Make sure you cloned the released weight diff into your local machine. The weight diff is located at:
|
| 22 |
+
https://huggingface.co/tatsu-lab/alpaca-7b/tree/main
|
| 23 |
+
3. Run this function with the correct paths. E.g.,
|
| 24 |
+
python weight_diff.py recover --path_raw <path_to_step_1_dir> --path_diff <path_to_step_2_dir> --path_tuned <path_to_store_recovered_weights>
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
Once step 3 completes, you should have a directory with the recovered weights, from which you can load the model like the following
|
| 28 |
+
|
| 29 |
+
```python
|
| 30 |
+
import transformers
|
| 31 |
+
alpaca_model = transformers.AutoModelForCausalLM.from_pretrained("<path_to_store_recovered_weights>")
|
| 32 |
+
alpaca_tokenizer = transformers.AutoTokenizer.from_pretrained("<path_to_store_recovered_weights>")
|
| 33 |
+
```
|