🧠 WeClone Deployment Note¶
Project Overview
This note records my complete deployment journey of WeClone, a local fine-tuning tool that turns chat history into a personalized language model, and its integration with AstrBot.
🚀 Environment Setup¶
✅ WSL2 Installation and Linux Environment¶
- Installed WSL2 with Ubuntu.
- Installed Git, Python 3.10+, pip, and
uvas a fast dependency manager.
Virtual Environment with uv
Use uv venv .venv to create a virtual environment and source .venv/bin/activate to activate it. This avoids interfering with system Python and supports pyproject.toml based dependency management.
✅ WeClone Project Setup¶
- GitHub Repo: WeClone
- Official Guide: weclone.love
flash-attn optional dependency
FlashAttention requires CUDA and nvcc. In WSL2, you must install the full CUDA toolkit and set CUDA_HOME before installing:
bash
uv pip install flash-attn --no-build-isolation
Skip this step if you're not training large models or running on CPU.
📦 Model Download via ModelScope¶
What is ModelScope?
ModelScope is a model hosting service by Alibaba DAMO Academy. It provides an easy CLI to download open-source foundation models. Model page
🗂️ Data Preprocessing¶
- Export WeChat chat history using PyWxDump.
- Place
.csvin./data/csv/folder. - Preprocess using:
Automated startup shortcut
Add to .bashrc:
bash
alias start-weclone='source ~/WeClone/.venv/bin/activate && weclone-cli server'
🧪 Model Finetuning & Testing¶
🌐 API & Interface¶
- Default listening on:
http://127.0.0.1:8005/v1
WSL Networking Tip
If WeClone runs in WSL2 and AstrBot runs in Docker, you must connect via WSL's internal IP (e.g. 172.24.x.x) rather than localhost.
Use ip addr show inside WSL to find this IP.
🤖 AstrBot Integration¶
- GitHub: AstrBot
- Docs: docs.astrbot.app
🌐 Model Provider Setup¶
-
If WeClone is hosted in WSL2:
-
Set API Base:
http://172.24.x.x:8005/v1 - Ensure WeClone server is running and accessible
💬 Messaging Platform Tips¶
- Feishu: Bot name in AstrBot must exactly match the name registered in Feishu platform.
- WeChat Personal: Use
wechatpadprowith Docker, and ensure proper config foradmin_key,host, andport. Docker network should allow communication between containers.
🧰 Other Tools & Tech Used¶
🐳 Docker Compose¶
Used to deploy supporting services like wechatpadpro:
- Web docs often at: http://localhost:38849/docs
📦 Python Modern Packaging¶
uv+pyproject.tomlfor dependency management- Supports multiple dependency groups (main/dev/test)
🔬 LLaMA Factory¶
- WeClone uses LLaMA-Factory under the hood to support LLM training and inference.
✅ Summary¶
This setup combines LLM training, API deployment, chat integration, and WSL networking. I now understand how to:
- Export and clean real-world chat data
- Run models locally with REST API
- Connect chatbots via Docker
- Build with modern Python toolchains (uv + pyproject.toml)
What’s Next?
I plan to try: - Multi-GPU or LoRA fine-tuning - Deploying the WeClone API via cloud (e.g. HuggingFace, EC2) - Integrating more platforms via AstrBot (Telegram, Discord, etc)