artidoro / qlora

QLoRA: Efficient Finetuning of Quantized LLMs
https://arxiv.org/abs/2305.14314
MIT License
9.96k stars 820 forks source link

batch_decode: TypeError: int() argument must be a string, a bytes-like object or a number, not 'list' #136

Open lcqlalala opened 1 year ago

lcqlalala commented 1 year ago

Traceback (most recent call last): File "/mnt/ssd/lcq/qlora-main/qlora.py", line 791, in train() File "/mnt/ssd/lcq/qlora-main/qlora.py", line 773, in train predictions = tokenizer.batch_decode( File "/mnt/ssd/lcq/conda_env/qlora/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 3464, in batch_decode return [ File "/mnt/ssd/lcq/conda_env/qlora/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 3465, in self.decode( File "/mnt/ssd/lcq/conda_env/qlora/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 3504, in decode return self._decode( File "/mnt/ssd/lcq/conda_env/qlora/lib/python3.9/site-packages/transformers/tokenization_utils.py", line 931, in _decode filtered_tokens = self.convert_ids_to_tokens(token_ids, skip_special_tokens=skip_special_tokens) File "/mnt/ssd/lcq/conda_env/qlora/lib/python3.9/site-packages/transformers/tokenization_utils.py", line 906, in convert_ids_to_tokens index = int(index) TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'

chchenhui commented 1 year ago

I also encountered this issue. Have you found any solutions?

chchenhui commented 1 year ago

Have you tried to add predictions = np.argmax(predictions, axis=-1) before decoding? Current prediction shape looks like (batch_size, length, vocabulary_size). We should require a shape like (batch_size, length).