model = ChatGLMForConditionalGeneration.from_pretrained(args.model_dir) config = LoraConfig(r=args.lora_r, lora_alpha[](https://zhida.zhihu.com/search?content_id=226105873&content_type=Article&match_order=1&q=lora_alpha&zd_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ6aGlkYV9zZXJ2ZXIiLCJleHAiOjE3OTExMzkxNDEsInEiOiJsb3JhX2FscGhhIiwiemhpZGFfc291cmNlIjoiZW50aXR5IiwiY29udGVudF9pZCI6MjI2MTA1ODczLCJjb250ZW50X3R5cGUiOiJBcnRpY2xlIiwibWF0Y2hfb3JkZXIiOjEsInpkX3Rva2VuIjpudWxsfQ.Ns3tttuwY6f77vbrhvwUQJub2T9-eqliRyXxYb0P3Gw&zhida_source=entity)=32, target_modules=["query_key_value"], lora_dropout=0.1, bias="none", task_type="CAUSAL_LM", inference_mode=False, ) model = get_peft_model[](https://zhida.zhihu.com/search?content_id=226105873&content_type=Article&match_order=1&q=peft_model&zd_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ6aGlkYV9zZXJ2ZXIiLCJleHAiOjE3OTExMzkxNDEsInEiOiJwZWZ0X21vZGVsIiwiemhpZGFfc291cmNlIjoiZW50aXR5IiwiY29udGVudF9pZCI6MjI2MTA1ODczLCJjb250ZW50X3R5cGUiOiJBcnRpY2xlIiwibWF0Y2hfb3JkZXIiOjEsInpkX3Rva2VuIjpudWxsfQ.usI5RIgeF7S8wLJomUWgRCifrtAbNpdBOTWeuYBRaKk&zhida_source=entity)(model, config)