ymcui / Chinese-LLaMA-Alpaca

中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
https://github.com/ymcui/Chinese-LLaMA-Alpaca/wiki
Apache License 2.0
17.98k stars 1.84k forks source link

AttributeError: 'LlamaTokenizerFast' object has no attribute 'sp_model' #866

Closed Kowsher closed 7 months ago

Kowsher commented 8 months ago

Check before submitting issues

Type of Issue

Model conversion and merging

Base Model

LLaMA-7B

Operating System

Linux

Describe your issue in detail

# Please copy-and-paste your command here.

When I'm going to Marge tokenizer, I get this error 'AttributeError: 'LlamaTokenizerFast' object has no attribute 'sp_model''

llama_spm = sp_pb2_model.ModelProto() llama_spm.ParseFromString(llama_tokenizer.sp_model.serialized_model_proto())

Dependencies (must be provided for code-related issues)

# Please copy-and-paste your dependencies here.

Execution logs or screenshots

# Please copy-and-paste your logs here.
ymcui commented 8 months ago

Did you use the recommended version of transformers? See requirements.txt

Kowsher commented 8 months ago

Did you use the recommended version of transformers? See requirements.txt

Yes, i followed it, but it works in tokenizer, facing issues in the fast tokenizer.

ymcui commented 8 months ago

Unfortunately, our script is only tested under non-fast tokenizer merging.

github-actions[bot] commented 8 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your consideration.

github-actions[bot] commented 7 months ago

Closing the issue, since no updates observed. Feel free to re-open if you need any further assistance.

CaoHanyun commented 7 months ago

That's true. I also ran into the same problem. And I think that's because LlamaTokenizerFast is not the same as LlamaTokenizer. The former is just a bpe-tokenizer(btw it is easy to load with a tokenizer.json trained by the library of huggingface/tokenizers), while the latter is equipped more with sp_model. It can be seen that LlamaTokenizerFast has no object named 'sp_model' till now.(https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/tokenization_llama_fast.py)

StephennFernandes commented 3 months ago

facing similar issue tried the recommended version, but still issue persists whats the fix for this ?