Text Generation
Transformers
Safetensors
Chinese
qwen3_5
image-text-to-text
qwen3.5
agriculture
agri-tech
lora
qlora
sft
unsloth
conversational
Instructions to use Agriwis/PENG-Qwen3.5-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Agriwis/PENG-Qwen3.5-2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Agriwis/PENG-Qwen3.5-2B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Agriwis/PENG-Qwen3.5-2B") model = AutoModelForMultimodalLM.from_pretrained("Agriwis/PENG-Qwen3.5-2B", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Agriwis/PENG-Qwen3.5-2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Agriwis/PENG-Qwen3.5-2B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Agriwis/PENG-Qwen3.5-2B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Agriwis/PENG-Qwen3.5-2B
- SGLang
How to use Agriwis/PENG-Qwen3.5-2B 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 "Agriwis/PENG-Qwen3.5-2B" \ --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": "Agriwis/PENG-Qwen3.5-2B", "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 "Agriwis/PENG-Qwen3.5-2B" \ --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": "Agriwis/PENG-Qwen3.5-2B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use Agriwis/PENG-Qwen3.5-2B with Docker Model Runner:
docker model run hf.co/Agriwis/PENG-Qwen3.5-2B
蜀农 · PENG — Qwen3.5-2B 农业领域 QLoRA 微调版
基于 Qwen3.5-2B 多模态基础模型,使用真实业务对话数据,通过 QLoRA 低资源微调得到的农业领域对话模型。
模型概览
| 属性 | 说明 |
|---|---|
| 模型名称 | 蜀农 · PENG(Qwen3.5-2B 农业领域微调版) |
| 基座模型 | Qwen/Qwen3.5-2B |
| 参数量 | 2B(约 20 亿) |
| 微调方法 | QLoRA(4-bit 量化 + LoRA),SFT 指令微调 |
| 硬件要求 | 最低 11 GB 显存(GTX 1080 Ti 可训可跑) |
| 上下文长度 | 262,144(原生) |
| 模态支持 | 文本 / 图像 / 视频(继承基座) |
模型定位
本模型是面向农业科技领域的垂直对话模型,基于农业科技创业团队的真实业务讨论数据微调,聚焦以下能力:
- 农业技术问答:种植、养殖、病虫害防治、智能灌溉、植保无人机、农业传感器等
模型架构
继承 Qwen3.5-2B 官方架构,未改动结构,仅通过 LoRA 适配器注入领域知识:
- 架构类型:
Qwen3_5ForConditionalGeneration(因果语言模型 + 视觉编码器) - 文本主干:24 层 Transformer,隐藏维度 2048
- 注意力混合:Gated DeltaNet 线性注意力 + 全注意力(6 组 × [3 线性注意力 + 1 全注意力])
- 词表大小:248,320(含图像/视频特殊 token)
- 上下文长度:262,144(原生)
- 视觉模块:24 层 ViT(patch 16 × 16),支持图像与视频输入
微调方法
采用 QLoRA(4-bit 量化 + 低秩适配)在单张 GTX 1080 Ti(11 GB)上完成训练,兼顾效果与硬件可行性:
- 基座加载:4-bit 量化(
load_in_4bit=True),fp16 计算精度(1080 Ti 不支持 bf16) - LoRA 配置:
r=16,alpha=16,dropout=0.0,bias=none - 注入模块:
q_proj / k_proj / v_proj / o_proj / gate_proj / up_proj / down_proj(注意力 + FFN 全部线性层) - 训练框架:unsloth
FastLanguageModel+ TRLSFTTrainer - 梯度优化:gradient checkpointing + 8-bit AdamW
训练超参数
文本微调(主训练)
| 超参数 | 值 |
|---|---|
| 最大序列长度 | 1024 |
| 批大小(per device) | 1 |
| 梯度累积步数 | 8 |
| 有效批大小 | 8 |
| 学习率 | 2e-4 |
| 训练轮数 | 3 |
| Warmup 步数 | 5 |
| 学习率调度 | cosine |
| 优化器 | adamw_8bit |
| 权重衰减 | 0.01 |
| 随机种子 | 42 |
| 精度 | fp16 |
局限性
- 未做标准化评测:当前未进行 MMLU、C-Eval 等基准测试,也未与基座做系统性的领域效果对比,建议在真实场景中验证后再上线。
- 幻觉风险:模型可能生成看似合理但未经核实的农业技术细节,重要决策需人工复核。
参考与致谢
- 基座模型:Qwen3.5-2B(Apache-2.0)
- 微调框架:unsloth、TRL、PEFT
- Downloads last month
- 124