Text Generation
PEFT
Safetensors
Transformers
qwen
lora
chinese-poetry
style-transfer
libai
conversational
Instructions to use shikunpunk/Qwen3.8-27B-LiBai with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use shikunpunk/Qwen3.8-27B-LiBai with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("/root/models/Qwen3.8-27B") model = PeftModel.from_pretrained(base_model, "shikunpunk/Qwen3.8-27B-LiBai") - Transformers
How to use shikunpunk/Qwen3.8-27B-LiBai with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="shikunpunk/Qwen3.8-27B-LiBai") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("shikunpunk/Qwen3.8-27B-LiBai", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use shikunpunk/Qwen3.8-27B-LiBai with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "shikunpunk/Qwen3.8-27B-LiBai" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shikunpunk/Qwen3.8-27B-LiBai", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/shikunpunk/Qwen3.8-27B-LiBai
- SGLang
How to use shikunpunk/Qwen3.8-27B-LiBai with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "shikunpunk/Qwen3.8-27B-LiBai" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shikunpunk/Qwen3.8-27B-LiBai", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "shikunpunk/Qwen3.8-27B-LiBai" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shikunpunk/Qwen3.8-27B-LiBai", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use shikunpunk/Qwen3.8-27B-LiBai with Docker Model Runner:
docker model run hf.co/shikunpunk/Qwen3.8-27B-LiBai
# Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("shikunpunk/Qwen3.8-27B-LiBai", device_map="auto")Quick Links
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(快速小规模版)
使用方法
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
- Downloads last month
- 16
Model tree for shikunpunk/Qwen3.8-27B-LiBai
Base model
Qwen/Qwen3.8-27B
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="shikunpunk/Qwen3.8-27B-LiBai") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)