ChatGLM2-6B
ChatGLM2-6B copied to clipboard
[Help] 如何进行ptuning训练
Is there an existing issue for this?
- [X] I have searched the existing issues
Current Behavior
训练后报错,AttributeError: 'ChatGLMModel' object has no attribute 'prefix_encoder'
Expected Behavior
No response
Steps To Reproduce
运行chatglm之前版本的ptuning来进行训练,修改了基底模型
Environment
- OS:
- Python:
- Transformers:
- PyTorch:
- CUDA Support (`python -c "import torch; print(torch.cuda.is_available())"`) :
Anything else?
No response
我也遇到跟你一样的问题 请问你解决了吗?
我也遇到这个问题
还没解决,感觉这个需要等待大佬们投喂了
坐等更新
按照chatglm-6b的方式ptuning微调 报错了 ChatGLMModel' object has no attribute 'prefix_encoder'
解决了吗?
解决了吗?
没有
按照chatglm-6b的方式ptuning微调 报错了 ChatGLMModel' object has no attribute 'prefix_encoder'
同样问题 解决了吗
按照chatglm-6b的方式ptuning微调 报错了 ChatGLMModel' object has no attribute 'prefix_encoder'
同样问题 解决了吗
没 坐等大佬们更新
坐等大佬开放
同问。
same error
按照chatglm-6b的方式ptuning微调 报错了 ChatGLMModel' object has no attribute 'prefix_encoder'
在ChatGLM-6b 1代里面这个报错可能是因为微调完推理的时候config里面没有定义pre_seq_len。
但是你确定ptuning可以直接用在2里面吗,modeling_glm.py没有定义self.prefix_encoder,所以这个错误是必然会报的。
按照chatglm-6b的方式ptuning微调 报错了 ChatGLMModel' object has no attribute 'prefix_encoder'
在ChatGLM-6b 1代里面这个报错可能是因为微调完推理的时候config里面没有定义pre_seq_len。
但是你确定ptuning可以直接用在2里面吗,modeling_glm.py没有定义self.prefix_encoder,所以这个错误是必然会报的。
好吧 ,谢谢大佬解答,我以为2会兼容一的方式进行微调。想测试他的微调效果。 那大佬你们都用什么方法进行微调的呢 本地两张3060(12G) 。
按照chatglm-6b的方式ptuning微调 报错了 ChatGLMModel' object has no attribute 'prefix_encoder'
在ChatGLM-6b 1代里面这个报错可能是因为微调完推理的时候config里面没有定义pre_seq_len。
但是你确定ptuning可以直接用在2里面吗,modeling_glm.py没有定义self.prefix_encoder,所以这个错误是必然会报的。
是的 我当时也是找了一圈 发现不知道用什么替代 只能等大佬更新 新的调试方法了
按照chatglm-6b的方式ptuning微调 报错了 ChatGLMModel' object has no attribute 'prefix_encoder'
在ChatGLM-6b 1代里面这个报错可能是因为微调完推理的时候config里面没有定义pre_seq_len。 但是你确定ptuning可以直接用在2里面吗,modeling_glm.py没有定义self.prefix_encoder,所以这个错误是必然会报的。
好吧 ,谢谢大佬解答,我以为2会兼容一的方式进行微调。想测试他的微调效果。 那大佬你们都用什么方法进行微调的呢 本地两张3060(12G) 。
你可以等等官方代码,我刚看huggingface上已经把modelling_glm的prefix_encoder更新了,估计很快就会把ptuning的代码push上来了吧。
模型更新了
按照chatglm-6b的方式ptuning微调 报错了 ChatGLMModel' object has no attribute 'prefix_encoder'
在ChatGLM-6b 1代里面这个报错可能是因为微调完推理的时候config里面没有定义pre_seq_len。 但是你确定ptuning可以直接用在2里面吗,modeling_glm.py没有定义self.prefix_encoder,所以这个错误是必然会报的。
好吧 ,谢谢大佬解答,我以为2会兼容一的方式进行微调。想测试他的微调效果。 那大佬你们都用什么方法进行微调的呢 本地两张3060(12G) 。
你可以等等官方代码,我刚看huggingface上已经把modelling_glm的prefix_encoder更新了,估计很快就会把ptuning的代码push上来了吧。
模型更新了 不报 prefix_encoder 的错误了 出了新的错误
模型更新了
按照chatglm-6b的方式ptuning微调 报错了 ChatGLMModel' object has no attribute 'prefix_encoder'
在ChatGLM-6b 1代里面这个报错可能是因为微调完推理的时候config里面没有定义pre_seq_len。 但是你确定ptuning可以直接用在2里面吗,modeling_glm.py没有定义self.prefix_encoder,所以这个错误是必然会报的。
好吧 ,谢谢大佬解答,我以为2会兼容一的方式进行微调。想测试他的微调效果。 那大佬你们都用什么方法进行微调的呢 本地两张3060(12G) 。
你可以等等官方代码,我刚看huggingface上已经把modelling_glm的prefix_encoder更新了,估计很快就会把ptuning的代码push上来了吧。
模型更新了 不报 prefix_encoder 的错误了 出了新的错误
我也遇到了相同的问题,可以改一下preprocess的方法
模型更新了
按照chatglm-6b的方式ptuning微调 报错了 ChatGLMModel' object has no attribute 'prefix_encoder'
在ChatGLM-6b 1代里面这个报错可能是因为微调完推理的时候config里面没有定义pre_seq_len。 但是你确定ptuning可以直接用在2里面吗,modeling_glm.py没有定义self.prefix_encoder,所以这个错误是必然会报的。
好吧 ,谢谢大佬解答,我以为2会兼容一的方式进行微调。想测试他的微调效果。 那大佬你们都用什么方法进行微调的呢 本地两张3060(12G) 。
你可以等等官方代码,我刚看huggingface上已经把modelling_glm的prefix_encoder更新了,估计很快就会把ptuning的代码push上来了吧。
模型更新了 不报 prefix_encoder 的错误了 出了新的错误
我也遇到了相同的问题,可以改一下preprocess的方法
大佬解决了么 方便私聊么 qq1241329431
模型更新了
按照chatglm-6b的方式ptuning微调 报错了 ChatGLMModel' object has no attribute 'prefix_encoder'
在ChatGLM-6b 1代里面这个报错可能是因为微调完推理的时候config里面没有定义pre_seq_len。 但是你确定ptuning可以直接用在2里面吗,modeling_glm.py没有定义self.prefix_encoder,所以这个错误是必然会报的。
好吧 ,谢谢大佬解答,我以为2会兼容一的方式进行微调。想测试他的微调效果。 那大佬你们都用什么方法进行微调的呢 本地两张3060(12G) 。
你可以等等官方代码,我刚看huggingface上已经把modelling_glm的prefix_encoder更新了,估计很快就会把ptuning的代码push上来了吧。
模型更新了 不报 prefix_encoder 的错误了 出了新的错误
我也遇到了相同的问题,可以改一下preprocess的方法
求修改方式这个咋个改好的?
模型更新了
按照chatglm-6b的方式ptuning微调 报错了 ChatGLMModel' object has no attribute 'prefix_encoder'
在ChatGLM-6b 1代里面这个报错可能是因为微调完推理的时候config里面没有定义pre_seq_len。 但是你确定ptuning可以直接用在2里面吗,modeling_glm.py没有定义self.prefix_encoder,所以这个错误是必然会报的。
好吧 ,谢谢大佬解答,我以为2会兼容一的方式进行微调。想测试他的微调效果。 那大佬你们都用什么方法进行微调的呢 本地两张3060(12G) 。
你可以等等官方代码,我刚看huggingface上已经把modelling_glm的prefix_encoder更新了,估计很快就会把ptuning的代码push上来了吧。
模型更新了 不报 prefix_encoder 的错误了 出了新的错误
我也遇到了相同的问题,可以改一下preprocess的方法
请问修改之后,模型预测的效果怎么样呀?我改了之后,输出都是空了。
模型更新了
按照chatglm-6b的方式ptuning微调 报错了 ChatGLMModel' object has no attribute 'prefix_encoder'
在ChatGLM-6b 1代里面这个报错可能是因为微调完推理的时候config里面没有定义pre_seq_len。 但是你确定ptuning可以直接用在2里面吗,modeling_glm.py没有定义self.prefix_encoder,所以这个错误是必然会报的。
好吧 ,谢谢大佬解答,我以为2会兼容一的方式进行微调。想测试他的微调效果。 那大佬你们都用什么方法进行微调的呢 本地两张3060(12G) 。
你可以等等官方代码,我刚看huggingface上已经把modelling_glm的prefix_encoder更新了,估计很快就会把ptuning的代码push上来了吧。
模型更新了 不报 prefix_encoder 的错误了 出了新的错误
我也遇到了相同的问题,可以改一下preprocess的方法
请问修改之后,模型预测的效果怎么样呀?我改了之后,输出都是空了。
改preprocess_function_train就行
preprocess_function_train
改preprocess_function_train就行 ` """ 为了适配ChatGLM1 context_length = input_ids.index(tokenizer.bos_token_id) mask_position = context_length - 1 labels = [-100] * context_length + input_ids[mask_position+1:] """
为了适配ChatGLM2,讲上面的代码改为下面的: context_length = len(input_ids) - len(b_ids) mask_position = context_length labels = [-100] * context_length + input_ids[mask_position:] `
又出现另外一个问题了。 RuntimeError: Default process group has not been initialized, please make sure to call init_process_group.
我可以了。
preprocess_function_train
改preprocess_function_train就行 ` """ 为了适配ChatGLM1 context_length = input_ids.index(tokenizer.bos_token_id) mask_position = context_length - 1 labels = [-100] * context_length + input_ids[mask_position+1:] """
为了适配ChatGLM2,讲上面的代码改为下面的: context_length = len(input_ids) - len(b_ids) mask_position = context_length labels = [-100] * context_length + input_ids[mask_position:] `
感谢大佬,我也可以了
preprocess_function_train
改preprocess_function_train就行 ` """ 为了适配ChatGLM1 context_length = input_ids.index(tokenizer.bos_token_id) mask_position = context_length - 1 labels = [-100] * context_length + input_ids[mask_position+1:] """
为了适配ChatGLM2,讲上面的代码改为下面的: context_length = len(input_ids) - len(b_ids) mask_position = context_length labels = [-100] * context_length + input_ids[mask_position:] `
这样改会不会有点问题,chatglm2的build_inputs_with_special_tokens和chatglm的方式有点不一样: chatglm2 [gmask, sop] + a_ids + b_ids + [eos] chatglm a_ids + [gmask, bos] + b_ids + [eos]
这样改前面的a_ids, b_ids的部分是有变更嘛?请问你自己训练在现在的任务上效果怎么样呀?
preprocess_function_train
改preprocess_function_train就行
""" 为了适配ChatGLM1 context_length = input_ids.index(tokenizer.bos_token_id) mask_position = context_length - 1 labels = [-100] * context_length + input_ids[mask_position+1:] """ 为了适配ChatGLM2,讲上面的代码改为下面的: context_length = len(input_ids) - len(b_ids) mask_position = context_length labels = [-100] * context_length + input_ids[mask_position:]
这样改会不会有点问题,chatglm2的build_inputs_with_special_tokens和chatglm的方式有点不一样: chatglm2 [gmask, sop] + a_ids + b_ids + [eos] chatglm a_ids + [gmask, bos] + b_ids + [eos]
这样改前面的a_ids, b_ids的部分是有变更嘛?请问你自己训练在现在的任务上效果怎么样呀?
就这么点数据训练了600步
推理基本没改变 不知道是不是模型太强大的原因
chatglm1按照这个方法https://github.com/THUDM/ChatGLM2-6B/issues/53#issuecomment-1619394916微调 问答的效果很好
preprocess_function_train
改preprocess_function_train就行
""" 为了适配ChatGLM1 context_length = input_ids.index(tokenizer.bos_token_id) mask_position = context_length - 1 labels = [-100] * context_length + input_ids[mask_position+1:] """ 为了适配ChatGLM2,讲上面的代码改为下面的: context_length = len(input_ids) - len(b_ids) mask_position = context_length labels = [-100] * context_length + input_ids[mask_position:]
这样改会不会有点问题,chatglm2的build_inputs_with_special_tokens和chatglm的方式有点不一样: chatglm2 [gmask, sop] + a_ids + b_ids + [eos] chatglm a_ids + [gmask, bos] + b_ids + [eos]
这样改前面的a_ids, b_ids的部分是有变更嘛?请问你自己训练在现在的任务上效果怎么样呀?
就是看了build_inputs_with_special_tokens的代码才这么改的