Instructions to use scisaga/qwen3-8b-instruct-lora-address-struct-cn with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use scisaga/qwen3-8b-instruct-lora-address-struct-cn with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="scisaga/qwen3-8b-instruct-lora-address-struct-cn") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("scisaga/qwen3-8b-instruct-lora-address-struct-cn") model = AutoModelForCausalLM.from_pretrained("scisaga/qwen3-8b-instruct-lora-address-struct-cn") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use scisaga/qwen3-8b-instruct-lora-address-struct-cn with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "scisaga/qwen3-8b-instruct-lora-address-struct-cn" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "scisaga/qwen3-8b-instruct-lora-address-struct-cn", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/scisaga/qwen3-8b-instruct-lora-address-struct-cn
- SGLang
How to use scisaga/qwen3-8b-instruct-lora-address-struct-cn 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 "scisaga/qwen3-8b-instruct-lora-address-struct-cn" \ --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": "scisaga/qwen3-8b-instruct-lora-address-struct-cn", "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 "scisaga/qwen3-8b-instruct-lora-address-struct-cn" \ --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": "scisaga/qwen3-8b-instruct-lora-address-struct-cn", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use scisaga/qwen3-8b-instruct-lora-address-struct-cn with Docker Model Runner:
docker model run hf.co/scisaga/qwen3-8b-instruct-lora-address-struct-cn
中文地址要素抽取 LoRA(Qwen3‑8B‑Instruct)
将中文地址文本直接生成 XML 标签串(如
<prov>…</prov><city>…</city>)。适配器采用 LoRA/QLoRA,与基座一起加载即可用于抽取省/市/区/道路/门牌/POI 等要素。
一、简介
- 任务:中文地址结构化(信息抽取 → 文本生成)。
- 形式:SFT 指令跟随;输入原始地址,输出 XML 标签串。
- 工程配套:提供 Web/REST 界面与 AMap 集成,以及 LoRA 数据与脚本。
二、代码与数据
代码仓库:Scisaga/addr-resolver(含 Web 端、API、LoRA 数据脚本、示例地址库等)。
- 关键目录/文件:
lora/bio2sft.py、lora/build_sft_from_adm.py、func/amap_call.py、func/qwen_call.py、app.py、resolver.py、address.db(示例库)等。
- 关键目录/文件:
系统能力:结合 高德地图 API 与 通义千问 进行解析/推理/定位;私有化地址库管理;提供 Docker 部署与前端页面。
三、训练
以
lora/目录产出的sft.jsonl为训练数据(BIO/BIES → SFT 一步式转换脚本已提供)。
CUDA_VISIBLE_DEVICES=0,1 torchrun --nproc_per_node=2 lora/train_hf_qlora.py \
--data lora/sft.jsonl --bf16
四、推理(docker)
docker run --gpus all --shm-size 1g -p 8080:80 \
-v $PWD/qwen3-8b-instruct-lora-address-struct-cn:/data \
ghcr.io/huggingface/text-generation-inference:latest \
--model-id /data \
--dtype bfloat16 \
--num-shard 2 \
--max-input-tokens 2048 --max-total-tokens 2304
五、许可
- 本仓库权重(适配器)与代码:CC BY 4.0(需署名、注明修改、不得施加额外法律/技术限制)。
- 基座 Qwen3‑8B‑Instruct:Apache‑2.0。如分发合并权重,需同时满足 Apache‑2.0(保留 LICENSE/NOTICE) 与 CC BY 4.0(署名/注明修改) 的要求。
推荐署名模板(在 README 或产品“关于”页中标注):
Uses the model by Scisaga (CC BY 4.0). Based on Qwen/Qwen3‑8B‑Instruct (Apache‑2.0). Changes: LoRA fine‑tuning for Chinese address slot extraction.
六、致谢 / 变更
- 2025‑10‑26:首版精简模型卡,补充仓库链接与目录映射;许可调整为 CC BY 4.0。
- Downloads last month
- 3