hiyouga / LLaMA-Factory

Unified Efficient Fine-Tuning of 100+ LLMs (ACL 2024)
https://arxiv.org/abs/2403.13372
Apache License 2.0
32.53k stars 3.98k forks source link

AttributeError: 'bool' object has no attribute '_pad' #5681

Open garry-jay opened 4 days ago

garry-jay commented 4 days ago

Reminder

System Info

(MindSpore) [root@fd428729b7cb46b089e3705e66eecb16-task0-0 LLaMA-Factory]# llamafactory-cli train examples/train_qlora/llama_lora_sft_bitsandbytes.yaml 10/12/2024 16:17:35 - INFO - llamafactory.hparams.parser - Process rank: 0, device: npu:0, n_gpu: 1, distributed training: False, compute dtype: torch.bfloat16 [INFO|configuration_utils.py:670] 2024-10-12 16:17:35,664 >> loading configuration file /tmp/code/mistral-7b-instruct-v0.3-bnb-4bit/config.json [INFO|configuration_utils.py:739] 2024-10-12 16:17:35,667 >> Model config MistralConfig { "_name_or_path": "/tmp/code/mistral-7b-instruct-v0.3-bnb-4bit", "architectures": [ "MistralForCausalLM" ], "attention_dropout": 0.0, "bos_token_id": 1, "eos_token_id": 2, "head_dim": 128, "hidden_act": "silu", "hidden_size": 4096, "initializer_range": 0.02, "intermediate_size": 14336, "max_position_embeddings": 32768, "model_type": "mistral", "num_attention_heads": 32, "num_hidden_layers": 32, "num_key_value_heads": 8, "pad_token_id": 770, "quantization_config": { "_load_in_4bit": true, "_load_in_8bit": false, "bnb_4bit_compute_dtype": "bfloat16", "bnb_4bit_quant_storage": "uint8", "bnb_4bit_quant_type": "nf4", "bnb_4bit_use_double_quant": true, "llm_int8_enable_fp32_cpu_offload": false, "llm_int8_has_fp16_weight": false, "llm_int8_skip_modules": null, "llm_int8_threshold": 6.0, "load_in_4bit": true, "load_in_8bit": false, "quant_method": "bitsandbytes" }, "rms_norm_eps": 1e-05, "rope_theta": 1000000.0, "sliding_window": null, "tie_word_embeddings": false, "torch_dtype": "bfloat16", "transformers_version": "4.45.0", "use_cache": true, "vocab_size": 32768 }

[INFO|tokenization_utils_base.py:2212] 2024-10-12 16:17:35,678 >> loading file tokenizer.model [INFO|tokenization_utils_base.py:2212] 2024-10-12 16:17:35,678 >> loading file tokenizer.json [INFO|tokenization_utils_base.py:2212] 2024-10-12 16:17:35,678 >> loading file added_tokens.json [INFO|tokenization_utils_base.py:2212] 2024-10-12 16:17:35,678 >> loading file special_tokens_map.json [INFO|tokenization_utils_base.py:2212] 2024-10-12 16:17:35,678 >> loading file tokenizer_config.json [INFO|tokenization_utils_base.py:2452] 2024-10-12 16:17:35,688 >> Unable to load tokenizer model from SPM, loading from TikToken will be attempted instead.(Google protobuf error: Tried to load SPM model with non-SPM vocab file). Traceback (most recent call last): File "/home/ma-user/anaconda3/envs/MindSpore/bin/llamafactory-cli", line 8, in sys.exit(main()) File "/tmp/code/LLaMA-Factory/src/llamafactory/cli.py", line 111, in main run_exp() File "/tmp/code/LLaMA-Factory/src/llamafactory/train/tuner.py", line 50, in run_exp run_sft(model_args, data_args, training_args, finetuning_args, generating_args, callbacks) File "/tmp/code/LLaMA-Factory/src/llamafactory/train/sft/workflow.py", line 44, in run_sft tokenizer_module = load_tokenizer(model_args) File "/tmp/code/LLaMA-Factory/src/llamafactory/model/loader.py", line 96, in load_tokenizer patch_tokenizer(tokenizer) File "/tmp/code/LLaMA-Factory/src/llamafactory/model/patcher.py", line 52, in patch_tokenizer if "PreTrainedTokenizerBase" not in str(tokenizer._pad.func): AttributeError: 'bool' object has no attribute '_pad'

Reproduction

(MindSpore) [root@fd428729b7cb46b089e3705e66eecb16-task0-0 LLaMA-Factory]# llamafactory-cli train examples/train_qlora/llama_lora_sft_bitsandbytes.yaml 10/12/2024 16:17:35 - INFO - llamafactory.hparams.parser - Process rank: 0, device: npu:0, n_gpu: 1, distributed training: False, compute dtype: torch.bfloat16 [INFO|configuration_utils.py:670] 2024-10-12 16:17:35,664 >> loading configuration file /tmp/code/mistral-7b-instruct-v0.3-bnb-4bit/config.json [INFO|configuration_utils.py:739] 2024-10-12 16:17:35,667 >> Model config MistralConfig { "_name_or_path": "/tmp/code/mistral-7b-instruct-v0.3-bnb-4bit", "architectures": [ "MistralForCausalLM" ], "attention_dropout": 0.0, "bos_token_id": 1, "eos_token_id": 2, "head_dim": 128, "hidden_act": "silu", "hidden_size": 4096, "initializer_range": 0.02, "intermediate_size": 14336, "max_position_embeddings": 32768, "model_type": "mistral", "num_attention_heads": 32, "num_hidden_layers": 32, "num_key_value_heads": 8, "pad_token_id": 770, "quantization_config": { "_load_in_4bit": true, "_load_in_8bit": false, "bnb_4bit_compute_dtype": "bfloat16", "bnb_4bit_quant_storage": "uint8", "bnb_4bit_quant_type": "nf4", "bnb_4bit_use_double_quant": true, "llm_int8_enable_fp32_cpu_offload": false, "llm_int8_has_fp16_weight": false, "llm_int8_skip_modules": null, "llm_int8_threshold": 6.0, "load_in_4bit": true, "load_in_8bit": false, "quant_method": "bitsandbytes" }, "rms_norm_eps": 1e-05, "rope_theta": 1000000.0, "sliding_window": null, "tie_word_embeddings": false, "torch_dtype": "bfloat16", "transformers_version": "4.45.0", "use_cache": true, "vocab_size": 32768 }

[INFO|tokenization_utils_base.py:2212] 2024-10-12 16:17:35,678 >> loading file tokenizer.model [INFO|tokenization_utils_base.py:2212] 2024-10-12 16:17:35,678 >> loading file tokenizer.json [INFO|tokenization_utils_base.py:2212] 2024-10-12 16:17:35,678 >> loading file added_tokens.json [INFO|tokenization_utils_base.py:2212] 2024-10-12 16:17:35,678 >> loading file special_tokens_map.json [INFO|tokenization_utils_base.py:2212] 2024-10-12 16:17:35,678 >> loading file tokenizer_config.json [INFO|tokenization_utils_base.py:2452] 2024-10-12 16:17:35,688 >> Unable to load tokenizer model from SPM, loading from TikToken will be attempted instead.(Google protobuf error: Tried to load SPM model with non-SPM vocab file). Traceback (most recent call last): File "/home/ma-user/anaconda3/envs/MindSpore/bin/llamafactory-cli", line 8, in sys.exit(main()) File "/tmp/code/LLaMA-Factory/src/llamafactory/cli.py", line 111, in main run_exp() File "/tmp/code/LLaMA-Factory/src/llamafactory/train/tuner.py", line 50, in run_exp run_sft(model_args, data_args, training_args, finetuning_args, generating_args, callbacks) File "/tmp/code/LLaMA-Factory/src/llamafactory/train/sft/workflow.py", line 44, in run_sft tokenizer_module = load_tokenizer(model_args) File "/tmp/code/LLaMA-Factory/src/llamafactory/model/loader.py", line 96, in load_tokenizer patch_tokenizer(tokenizer) File "/tmp/code/LLaMA-Factory/src/llamafactory/model/patcher.py", line 52, in patch_tokenizer if "PreTrainedTokenizerBase" not in str(tokenizer._pad.func): AttributeError: 'bool' object has no attribute '_pad'

Expected behavior

这要怎么改呢

Others

No response

night666e commented 2 days ago

有进展解决吗?是不支持glm3了吗