hi,作者,我有一个问题需要咨询一下。谢谢。
使用api_demo.py ,启动合并后的模型跟checkpoint_dir,启动时失败。下面是错误信息:
Some weights of the model checkpoint at /data/project/ChatGLM-Efficient-Tuning/path_to_export were not used when initializing ChatGLMForConditionalGeneration: ['lm_head.weight']
This IS expected if you are initializing ChatGLMForConditionalGeneration from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
This IS NOT expected if you are initializing ChatGLMForConditionalGeneration from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
07/16/2023 18:22:04 - INFO - glmtuner.tuner.core.adapter - Fine-tuning method: LoRA
07/16/2023 18:22:17 - INFO - glmtuner.tuner.core.adapter - Merged 1 model checkpoint(s).
07/16/2023 18:22:17 - INFO - glmtuner.tuner.core.adapter - Loaded fine-tuned model from checkpoint(s): /data/project/ChatGLM-Efficient-Tuning/examples/path_to_sft_checkpoint100
trainable params: 0 || all params: 6243584000 || trainable%: 0.0000
Traceback (most recent call last):
File "/data/project/ChatGLM-Efficient-Tuning/src/api_demo.py", line 12, in
app = create_app()
File "/data/project/ChatGLM-Efficient-Tuning/src/glmtuner/api/app.py", line 32, in create_app
chat_model = ChatModel(*get_infer_args())
File "/data/project/ChatGLM-Efficient-Tuning/src/glmtuner/chat/stream_chat.py", line 22, in init
self.model = dispatch_model(self.model, device_map)
File "/home/fastchat/miniconda3/envs/chatGLM-efficient/lib/python3.10/site-packages/accelerate/big_modeling.py", line 321, in dispatch_model
check_device_map(model, device_map)
File "/home/fastchat/miniconda3/envs/chatGLM-efficient/lib/python3.10/site-packages/accelerate/utils/modeling.py", line 1067, in check_device_map
raise ValueError(
ValueError: The device_map provided does not give any device for the following parameters: transformer.embedding.word_embeddings.weight, transformer.rotary_pos_emb.inv_freq, transformer.encoder.layers.0.input_layernorm.weight, transformer.encoder.layers.0.self_attention.query_key_value.weight, transformer.encoder.layers.0.self_attention.query_key_value.bias, transformer.encoder.layers.0.self_attention.dense.weight, transformer.encoder.layers.0.post_attention_layernorm.weight, transformer.encoder.layers.0.mlp.dense_h_to_4h.weight, transformer.encoder.layers.0.mlp.dense_4h_to_h.weight, transformer.encoder.layers.1.input_layernorm.weight, transformer.encoder.layers.1.self_attention.query_key_value.weight, transformer.encoder.layers.1.self_attention.query_key_value.bias, transformer.encoder.layers.1.self_attention.dense.weight, transformer.encoder.layers.1.post_attention_layernorm.weight, transformer.encoder.layers.1.mlp.dense_h_to_4h.weight, transformer.encoder.layers.1.mlp.dense_4h_to_h.weight, transformer.encoder.layers.2.input_layernorm.weight, transformer.encoder.layers.2.self_attention.query_key_value.weight, transformer.encoder.layers.2.self_attention.query_key_value.bias, transformer.encoder.layers.2.self_attention.dense.weight, transformer.encoder.layers.2.post_attention_layernorm.weight, transformer.encoder.layers.2.mlp.dense_h_to_4h.weight, transformer.encoder.layers.2.mlp.dense_4h_to_h.weight, transformer.encoder.layers.3.input_layernorm.weight, transformer.encoder.layers.3.self_attention.query_key_value.weight, transformer.encoder.layers.3.self_attention.query_key_value.bias, transformer.encoder.layers.3.self_attention.dense.weight, transformer.encoder.layers.3.post_attention_layernorm.weight, transformer.encoder.layers.3.mlp.dense_h_to_4h.weight, transformer.encoder.layers.3.mlp.dense_4h_to_h.weight, transformer.encoder.layers.4.input_layernorm.weight, transformer.encoder.layers.4.self_attention.query_key_value.weight, transformer.encoder.layers.4.self_attention.query_key_value.bias, transformer.encoder.layers.4.self_attention.dense.weight, transformer.encoder.layers.4.post_attention_layernorm.weight, transformer.encoder.layers.4.mlp.dense_h_to_4h.weight, transformer.encoder.layers.4.mlp.dense_4h_to_h.weight, transformer.encoder.layers.5.input_layernorm.weight, transformer.encoder.layers.5.self_attention.query_key_value.weight, transformer.encoder.layers.5.self_attention.query_key_value.bias, transformer.encoder.layers.5.self_attention.dense.weight, transformer.encoder.layers.5.post_attention_layernorm.weight, transformer.encoder.layers.5.mlp.dense_h_to_4h.weight, transformer.encoder.layers.5.mlp.dense_4h_to_h.weight, transformer.encoder.layers.6.input_layernorm.weight, transformer.encoder.layers.6.self_attention.query_key_value.weight, transformer.encoder.layers.6.self_attention.query_key_value.bias, transformer.encoder.layers.6.self_attention.dense.weight, transformer.encoder.layers.6.post_attention_layernorm.weight, transformer.encoder.layers.6.mlp.dense_h_to_4h.weight, transformer.encoder.layers.6.mlp.dense_4h_to_h.weight, transformer.encoder.layers.7.input_layernorm.weight, transformer.encoder.layers.7.self_attention.query_key_value.weight, transformer.encoder.layers.7.self_attention.query_key_value.bias, transformer.encoder.layers.7.self_attention.dense.weight, transformer.encoder.layers.7.post_attention_layernorm.weight, transformer.encoder.layers.7.mlp.dense_h_to_4h.weight, transformer.encoder.layers.7.mlp.dense_4h_to_h.weight, transformer.encoder.layers.8.input_layernorm.weight, transformer.encoder.layers.8.self_attention.query_key_value.weight, transformer.encoder.layers.8.self_attention.query_key_value.bias, transformer.encoder.layers.8.self_attention.dense.weight, transformer.encoder.layers.8.post_attention_layernorm.weight, transformer.encoder.layers.8.mlp.dense_h_to_4h.weight, transformer.encoder.layers.8.mlp.dense_4h_to_h.weight, transformer.encoder.layers.9.input_layernorm.weight, transformer.encoder.layers.9.self_attention.query_key_value.weight, transformer.encoder.layers.9.self_attention.query_key_value.bias, transformer.encoder.layers.9.self_attention.dense.weight, transformer.encoder.layers.9.post_attention_layernorm.weight, transformer.encoder.layers.9.mlp.dense_h_to_4h.weight, transformer.encoder.layers.9.mlp.dense_4h_to_h.weight, transformer.encoder.layers.10.input_layernorm.weight, transformer.encoder.layers.10.self_attention.query_key_value.weight, transformer.encoder.layers.10.self_attention.query_key_value.bias, transformer.encoder.layers.10.self_attention.dense.weight, transformer.encoder.layers.10.post_attention_layernorm.weight, transformer.encoder.layers.10.mlp.dense_h_to_4h.weight, transformer.encoder.layers.10.mlp.dense_4h_to_h.weight, transformer.encoder.layers.11.input_layernorm.weight, transformer.encoder.layers.11.self_attention.query_key_value.weight, transformer.encoder.layers.11.self_attention.query_key_value.bias, transformer.encoder.layers.11.self_attention.dense.weight, transformer.encoder.layers.11.post_attention_layernorm.weight, transformer.encoder.layers.11.mlp.dense_h_to_4h.weight, transformer.encoder.layers.11.mlp.dense_4h_to_h.weight, transformer.encoder.layers.12.input_layernorm.weight, transformer.encoder.layers.12.self_attention.query_key_value.weight, transformer.encoder.layers.12.self_attention.query_key_value.bias, transformer.encoder.layers.12.self_attention.dense.weight, transformer.encoder.layers.12.post_attention_layernorm.weight, transformer.encoder.layers.12.mlp.dense_h_to_4h.weight, transformer.encoder.layers.12.mlp.dense_4h_to_h.weight, transformer.encoder.layers.13.input_layernorm.weight, transformer.encoder.layers.13.self_attention.query_key_value.weight, transformer.encoder.layers.13.self_attention.query_key_value.bias, transformer.encoder.layers.13.self_attention.dense.weight, transformer.encoder.layers.13.post_attention_layernorm.weight, transformer.encoder.layers.13.mlp.dense_h_to_4h.weight, transformer.encoder.layers.13.mlp.dense_4h_to_h.weight, transformer.encoder.layers.14.input_layernorm.weight, transformer.encoder.layers.14.self_attention.query_key_value.weight, transformer.encoder.layers.14.self_attention.query_key_value.bias, transformer.encoder.layers.14.self_attention.dense.weight, transformer.encoder.layers.14.post_attention_layernorm.weight, transformer.encoder.layers.14.mlp.dense_h_to_4h.weight, transformer.encoder.layers.14.mlp.dense_4h_to_h.weight, transformer.encoder.layers.15.input_layernorm.weight, transformer.encoder.layers.15.self_attention.query_key_value.weight, transformer.encoder.layers.15.self_attention.query_key_value.bias, transformer.encoder.layers.15.self_attention.dense.weight, transformer.encoder.layers.15.post_attention_layernorm.weight, transformer.encoder.layers.15.mlp.dense_h_to_4h.weight, transformer.encoder.layers.15.mlp.dense_4h_to_h.weight, transformer.encoder.layers.16.input_layernorm.weight, transformer.encoder.layers.16.self_attention.query_key_value.weight, transformer.encoder.layers.16.self_attention.query_key_value.bias, transformer.encoder.layers.16.self_attention.dense.weight, transformer.encoder.layers.16.post_attention_layernorm.weight, transformer.encoder.layers.16.mlp.dense_h_to_4h.weight, transformer.encoder.layers.16.mlp.dense_4h_to_h.weight, transformer.encoder.layers.17.input_layernorm.weight, transformer.encoder.layers.17.self_attention.query_key_value.weight, transformer.encoder.layers.17.self_attention.query_key_value.bias, transformer.encoder.layers.17.self_attention.dense.weight, transformer.encoder.layers.17.post_attention_layernorm.weight, transformer.encoder.layers.17.mlp.dense_h_to_4h.weight, transformer.encoder.layers.17.mlp.dense_4h_to_h.weight, transformer.encoder.layers.18.input_layernorm.weight, transformer.encoder.layers.18.self_attention.query_key_value.weight, transformer.encoder.layers.18.self_attention.query_key_value.bias, transformer.encoder.layers.18.self_attention.dense.weight, transformer.encoder.layers.18.post_attention_layernorm.weight, transformer.encoder.layers.18.mlp.dense_h_to_4h.weight, transformer.encoder.layers.18.mlp.dense_4h_to_h.weight, transformer.encoder.layers.19.input_layernorm.weight, transformer.encoder.layers.19.self_attention.query_key_value.weight, transformer.encoder.layers.19.self_attention.query_key_value.bias, transformer.encoder.layers.19.self_attention.dense.weight, transformer.encoder.layers.19.post_attention_layernorm.weight, transformer.encoder.layers.19.mlp.dense_h_to_4h.weight, transformer.encoder.layers.19.mlp.dense_4h_to_h.weight, transformer.encoder.layers.20.input_layernorm.weight, transformer.encoder.layers.20.self_attention.query_key_value.weight, transformer.encoder.layers.20.self_attention.query_key_value.bias, transformer.encoder.layers.20.self_attention.dense.weight, transformer.encoder.layers.20.post_attention_layernorm.weight, transformer.encoder.layers.20.mlp.dense_h_to_4h.weight, transformer.encoder.layers.20.mlp.dense_4h_to_h.weight, transformer.encoder.layers.21.input_layernorm.weight, transformer.encoder.layers.21.self_attention.query_key_value.weight, transformer.encoder.layers.21.self_attention.query_key_value.bias, transformer.encoder.layers.21.self_attention.dense.weight, transformer.encoder.layers.21.post_attention_layernorm.weight, transformer.encoder.layers.21.mlp.dense_h_to_4h.weight, transformer.encoder.layers.21.mlp.dense_4h_to_h.weight, transformer.encoder.layers.22.input_layernorm.weight, transformer.encoder.layers.22.self_attention.query_key_value.weight, transformer.encoder.layers.22.self_attention.query_key_value.bias, transformer.encoder.layers.22.self_attention.dense.weight, transformer.encoder.layers.22.post_attention_layernorm.weight, transformer.encoder.layers.22.mlp.dense_h_to_4h.weight, transformer.encoder.layers.22.mlp.dense_4h_to_h.weight, transformer.encoder.layers.23.input_layernorm.weight, transformer.encoder.layers.23.self_attention.query_key_value.weight, transformer.encoder.layers.23.self_attention.query_key_value.bias, transformer.encoder.layers.23.self_attention.dense.weight, transformer.encoder.layers.23.post_attention_layernorm.weight, transformer.encoder.layers.23.mlp.dense_h_to_4h.weight, transformer.encoder.layers.23.mlp.dense_4h_to_h.weight, transformer.encoder.layers.24.input_layernorm.weight, transformer.encoder.layers.24.self_attention.query_key_value.weight, transformer.encoder.layers.24.self_attention.query_key_value.bias, transformer.encoder.layers.24.self_attention.dense.weight, transformer.encoder.layers.24.post_attention_layernorm.weight, transformer.encoder.layers.24.mlp.dense_h_to_4h.weight, transformer.encoder.layers.24.mlp.dense_4h_to_h.weight, transformer.encoder.layers.25.input_layernorm.weight, transformer.encoder.layers.25.self_attention.query_key_value.weight, transformer.encoder.layers.25.self_attention.query_key_value.bias, transformer.encoder.layers.25.self_attention.dense.weight, transformer.encoder.layers.25.post_attention_layernorm.weight, transformer.encoder.layers.25.mlp.dense_h_to_4h.weight, transformer.encoder.layers.25.mlp.dense_4h_to_h.weight, transformer.encoder.layers.26.input_layernorm.weight, transformer.encoder.layers.26.self_attention.query_key_value.weight, transformer.encoder.layers.26.self_attention.query_key_value.bias, transformer.encoder.layers.26.self_attention.dense.weight, transformer.encoder.layers.26.post_attention_layernorm.weight, transformer.encoder.layers.26.mlp.dense_h_to_4h.weight, transformer.encoder.layers.26.mlp.dense_4h_to_h.weight, transformer.encoder.layers.27.input_layernorm.weight, transformer.encoder.layers.27.self_attention.query_key_value.weight, transformer.encoder.layers.27.self_attention.query_key_value.bias, transformer.encoder.layers.27.self_attention.dense.weight, transformer.encoder.layers.27.post_attention_layernorm.weight, transformer.encoder.layers.27.mlp.dense_h_to_4h.weight, transformer.encoder.layers.27.mlp.dense_4h_to_h.weight, transformer.encoder.final_layernorm.weight, transformer.output_layer.weight
hi,作者,我有一个问题需要咨询一下。谢谢。 使用api_demo.py ,启动合并后的模型跟checkpoint_dir,启动时失败。下面是错误信息: Some weights of the model checkpoint at /data/project/ChatGLM-Efficient-Tuning/path_to_export were not used when initializing ChatGLMForConditionalGeneration: ['lm_head.weight']