ChatGLM-Efficient-Tuning
ChatGLM-Efficient-Tuning copied to clipboard
Fine-tuning ChatGLM-6B with PEFT | 基于 PEFT 的高效 ChatGLM 微调
我就是推荐配置,官方训练脚本24G绝对超显存。
class WandbCallback(TrainerCallback): def __init__(self): super().__init__() def on_train_end(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs): # 在训练结束时进行初始化 wandb.log({'epoch': 0, 'loss': 0, 'accuracy': 0}) def on_epoch_begin(self, args: TrainingArguments, state: TrainerState, control: TrainerControl,...
如图,同等参数微调下的预测结果,上图为chatglm2,下图为chatglm  
 微调时,出现了较多的数据重复现象,实际上,我完整的数据还没有完全encode  有一个问题,原文还没有结束,但是却会把原文一段替换给到未结束的部分。 chatglm2的token长度得到了较大的更新,我要如何修改代码,突破长度限制?
tokenizer = AutoTokenizer.from_pretrained("chatglm2-6b", trust_remote_code=True) model = AutoModel.from_pretrained("chatglm2-6b", trust_remote_code=True).cuda() model = PeftModel.from_pretrained(model, "weights").half()
使用int4量化lora微调,24G的3090会OOM,想问一下运行起来大概需要多少显存呢 训练的参数如下: ```bash CUDA_VISIBLE_DEVICES=1 python src/train_sft.py \ --model_name_or_path THUDM/chatglm2-6b \ --do_train \ --dataset code_helper \ --finetuning_type lora \ --lora_rank 8 \ --quantization_bit 4 \ --output_dir code_helper \ --per_device_train_batch_size 2 \...