Update LLaMA-model.md (#2460)

Better approach of converting LLaMA model
This commit is contained in:
zaypen 2023-06-08 02:34:50 +08:00 committed by GitHub
parent eb2601a8c3
commit 084b006cfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,15 @@ pip install protobuf==3.20.1
2. Use the script below to convert the model in `.pth` format that you, a fellow academic, downloaded using Meta's official link: 2. Use the script below to convert the model in `.pth` format that you, a fellow academic, downloaded using Meta's official link:
### [convert_llama_weights_to_hf.py](https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/convert_llama_weights_to_hf.py) ### Convert LLaMA to HuggingFace format
If you have `transformers` installed in place
```
python -m transformers.models.llama.convert_llama_weights_to_hf --input_dir /path/to/LLaMA --model_size 7B --output_dir /tmp/outputs/llama-7b
```
Otherwise download script [convert_llama_weights_to_hf.py](https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/convert_llama_weights_to_hf.py)
``` ```
python convert_llama_weights_to_hf.py --input_dir /path/to/LLaMA --model_size 7B --output_dir /tmp/outputs/llama-7b python convert_llama_weights_to_hf.py --input_dir /path/to/LLaMA --model_size 7B --output_dir /tmp/outputs/llama-7b