Add PLaMo-13B model as an LLM example (#303)

* Convert HF weights of PLaMo and load it to a plamo model in mlx

* Fix model inference part

* Add bos at the beginning of the prompt

* Fix convert.py to copy tokenizer.model into the converted dir

* Use the required insturction format in generate.py when "--instruct" option is specified

* Change filenames and update existing scripts

* Add README

* Add requirements.txt

* Fix plamo.py to stop generation when EOS appears

* Add quantization to convert.py

* Use mlx>=0.0.9 for mx.core.outer() in PLaMo model

* Update acknowledgements.md

* Fix card text in upload_to_hub()

* Not use prompt template when --instruct is not specified

* Ask if you trust_remote_code for loading tokenizer of PLaMo

* Check the user trusts the remote code when converting

* Remove plamo directory

* Update README

* Add PLaMo model file

* Fix the handling of cache in PLaMo and update README

* Ask if trust_remote_code only when the model is PLaMo

* Remove resolve_trust_remote_code from convert.py and use the latest transformers

* Remove code not to add EOS

* Update README to fix an example not to use noncommercial version of the model

* Remove unused imports

* Remove unnecessary description about the instruct model of PLaMo from README

* format, nits in README

* typo

---------

Co-authored-by: Shunta Saito <shunta@mitmul-mbp.local>
Co-authored-by: Awni Hannun <awni@apple.com>
This commit is contained in:
Shunta Saito
2024-01-24 00:17:24 +09:00
committed by GitHub
parent c45c2311bd
commit 85c1ff8fd6
4 changed files with 387 additions and 13 deletions

View File

@@ -10,7 +10,7 @@ from huggingface_hub import snapshot_download
from transformers import AutoTokenizer, PreTrainedTokenizer
# Local imports
from .models import llama, mixtral, phi2, qwen
from .models import llama, mixtral, phi2, plamo, qwen
# Constants
MODEL_MAPPING = {
@@ -19,6 +19,7 @@ MODEL_MAPPING = {
"mixtral": mixtral,
"phi": phi2,
"qwen": qwen,
"plamo": plamo,
}
linear_class_predicate = (