Skip to content

Commit f6068cd

Browse files
Merge pull request #27 from wgzintel/guozhong/fix_chatglm2-6b_cannot_set_attribute
Add solution of chatglm2-6b cannot set attribute to Readme
2 parents 212f29d + 66982eb commit f6068cd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

llm_bench/python/README.md

+21
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,24 @@ Add the option `--torch_compile_backend` with the desired backend: `pytorch` or
110110
```bash
111111
python ./benchmark.py -m models/llama-2-7b-chat/pytorch -d CPU --torch_compile_backend openvino
112112
```
113+
# Notes
114+
## chatglm2-6b - AttributeError: can't set attribute
115+
Download chatglm2-6b from hugginface, convert to OpenVINO IR files and run with benchmark.py, the following error may occur:
116+
```bash
117+
AttributeError: can't set attribute
118+
```
119+
Reproduced with https://huggingface.co/THUDM/chatglm2-6b 7fabe56db91e085c9c027f56f1c654d137bdba40 <br />
120+
As on https://huggingface.co/THUDM/chatglm2-6b/discussions/99 <br />
121+
Solution: update `tokenization_chatglm.py` as following: <br />
122+
```Python
123+
self.vocab_file = vocab_file
124+
self.tokenizer = SPTokenizer(vocab_file)
125+
+ kwargs.pop("eos_token", None)
126+
+ kwargs.pop("pad_token", None)
127+
+ kwargs.pop("unk_token", None)
128+
self.special_tokens = {
129+
"<bos>": self.tokenizer.bos_id,
130+
"<eos>": self.tokenizer.eos_id,
131+
```
132+
133+
> The solution works for chatglm3-6b as well.

0 commit comments

Comments
 (0)