--- base_model: Qwen/Qwen3.8-27B library_name: peft pipeline_tag: text-generation tags: - qwen - lora - transformers - chinese-poetry - style-transfer - libai --- # Qwen3.8-27B LiBai LoRA Adapter(李白风格 SFT) 基于 `Qwen/Qwen3.8-27B` 的李白风格 QLoRA SFT adapter。 ## 模型说明 - **基座模型**:Qwen/Qwen3.8-27B(Qwen3_5 架构,多模态条件生成) - **训练方法**:QLoRA 4-bit SFT(NF4 + double quant,LoRA r=16, alpha=32, dropout=0.05) - **训练数据**:李白诗集 300 条(`libai_train_300.jsonl`,ShareGPT 格式:system=李白风格人设 + human=创作请求 + gpt=真实李白诗) - **训练配置**:4 epochs,max_len=768,batch=2,grad_accum=8,lr=2e-4 - **训练结果**:train_loss 2.55 → 0.197(快速小规模版) ## 使用方法 ```python from transformers import AutoModelForCausalLM, AutoProcessor, BitsAndBytesConfig from peft import PeftModel import torch base = "Qwen/Qwen3.8-27B" adapter = "shikunpunk/Qwen3.8-27B-LiBai" quant = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_compute_dtype=torch.bfloat16, bnb_4bit_quant_type="nf4", bnb_4bit_use_double_quant=True) model = AutoModelForCausalLM.from_pretrained(base, trust_remote_code=True, torch_dtype=torch.bfloat16, device_map="auto", quantization_config=quant) model = PeftModel.from_pretrained(model, adapter, is_trainable=False) processor = AutoProcessor.from_pretrained(base, trust_remote_code=True) model.eval() ``` ## 说明 - 该 adapter 用于李白风格诗歌生成;配合 KTO 后训练版本 `shikunpunk/Qwen3.8-27B-LiBai-KTO` 使用效果更佳。 - 数据与训练脚本见 GitHub:https://github.com/shikunpneg/ChineseHardJudgePoem - 风格池:`data/libai_train.jsonl`(838 条) ## 许可证 MIT