Text Generation
Transformers
Safetensors
English
Chinese
spark2_5
llm
sparkx2_5
conversational
custom_code
Instructions to use XHToken/Spark-X2.6-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use XHToken/Spark-X2.6-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="XHToken/Spark-X2.6-4B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("XHToken/Spark-X2.6-4B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use XHToken/Spark-X2.6-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "XHToken/Spark-X2.6-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "XHToken/Spark-X2.6-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/XHToken/Spark-X2.6-4B
- SGLang
How to use XHToken/Spark-X2.6-4B 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 "XHToken/Spark-X2.6-4B" \ --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": "XHToken/Spark-X2.6-4B", "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 "XHToken/Spark-X2.6-4B" \ --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": "XHToken/Spark-X2.6-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use XHToken/Spark-X2.6-4B with Docker Model Runner:
docker model run hf.co/XHToken/Spark-X2.6-4B
[HER Hack-Astron # 7] [Disaster Response] RescueLens — Emergency Triage Engine
#24
by Deamy112 - opened
[HER Hack-Astron # 7] [Disaster Response / 公益应用] RescueLens (救援智标) — Humanitarian Emergency Triage & Decision-Support System powered by Spark-X2.6-4B
作品名称与方向 / Project Name & Track
- 作品名称 / Project Name: RescueLens (救援智标) — Offline-Ready Disaster Relief & SOS Triage Engine
- 参赛方向 / Track: Disaster preparedness and response (防灾减灾与应急救援)
服务对象与解决的问题 / Target Audience & Problem
- 目标用户 / Target Audience:
- 第一响应调度中心 (Emergency First-Response Dispatchers)
- 基层救灾协调志愿者与非政府组织 (Disaster Relief NGOs & Ground Volunteer Coordinators)
- 偏远及通信受阻灾区的基层应急管理人员 (Local emergency teams operating under low-bandwidth/offline conditions)
- 具体场景与痛点 / Scenario & Pain Point:
- 洪涝、强震、台风等重大突发灾难发生后,应急电话、社交平台与短信渠道往往在数小时内涌入海量杂乱无章的群众求救信息(言语情绪激动、方言混杂、地标指代模糊、关键生理需求不清)。
- 人工接警员在极端工作负荷下面临巨大的认知负荷,极易错漏由于缺少救命药品(如胰岛素)、受困危房、燃气泄漏、孕妇或婴儿受困等最危急的 P1 生命级险情。
- 预期公益价值 / Public Benefit Value:
- 秒级结构化分级:毫秒级完成海量求助信息标准化分类(P1 紧急特危 / P2 严重求助 / P3 物资常规储备)。
- 黄金生命通道守卫:精准定位危急弱势人群(婴儿、无药高龄患者、受困伤者),提前自动匹配救援资产(冲锋舟、破拆设备、冷链急救药品、备用柴油),缩短出警判定时间 70% 以上。
Spark-X2.6-4B 使用说明 / Model Usage
- 模型来源与 revision / Model Source & Revision:
- Official Hugging Face:
XHToken/Spark-X2.6-4B - Model Revision SHA:
d1b5f26071101c27fcd07728e7a7770e428281f4
- Official Hugging Face:
- 模型在应用中承担的功能 / Model Role:
- **可控思考推理 (
<think>...</think>)**:利用 Spark-X2.6-4B 特有的推理思考能力,对非结构化求助文本进行因果分析(生命危险评估、环境次生灾害研判、地标模糊消歧)。 - 标准化人道主义 JSON 提取:将复杂的求助信息直接转化为符合 EDXL/人道主义救灾标准的数据结构(包含优先级打分 1-10、地标线索提取、人口画像统计、救援装备清单及次生危害警告)。
- **可控思考推理 (
- 使用的其他模型、工具或服务(如有) / Other Tools/Services:
- Streamlit (轻量级本地应急调度控制台)
- Pydantic v2 (严格的数据结构防呆校验)
- Playwright (全自动化真实端到端测试与截屏生成)
Demo(必填:视频或图文二选一)/ Demo (Illustrated Walkthrough)
1. 应急调度控制台全景 (Mission Control Dashboard Overview)
运行控制台具备任务配置、模型 revision 溯源、多种通信信道(短信/社媒/应急电台/庇护所)输入及一键推理:
- 运行截图:
screenshots/01_dashboard_overview.png
2. 实战案例:洪涝危急求助全流程分类 (Flash Flood P1-Immediate Triage)
- 示例输入 / Example Input:
Incident ID: EMERGENCY-2026-001 Channel: SMS / Citizen Hotline Message: "HELP PLEASE!! Water is already reaching the second floor of our house near Riverside Avenue and 4th St behind the old brick bakery! My elderly grandmother (82, diabetic) has run out of insulin and there are 4 of us including an 8-month-old infant. Power went out 2 hours ago and cell signal is cutting out! We have no boat. Please send rescue boat immediately!" - Spark-X2.6-4B 真实思考过程 (
<think>):1. Threat to life analysis: Water reaching living floors (second floor), power failure, cut-off communication. Elderly grandmother is diabetic with zero insulin remaining. 8-month-old infant is present. 2. Geographic and landmark extraction: Riverside Avenue, 4th St, old brick bakery. 3. Resource logistics mapping: Requires swift watercraft rescue team with pediatric flotation gear, plus emergency paramedic dispatch with refrigerated insulin. 4. Priority outcome: P1-Immediate (Urgency score 9/10). - 实际输出结构体 (Actual Humanitarian JSON Output):
{ "incident_id": "EMERGENCY-2026-001", "priority_level": "P1-Immediate", "urgency_score": 9, "disaster_category": "Flood", "summary": "Automated priority assessment: P1-Immediate assigned due to trapped diabetic elder without insulin and infant under rapidly rising flood waters.", "location": { "raw_location_text": "Riverside Avenue", "landmarks": ["Riverside Avenue", "4th St"], "gps_coordinates": null }, "demographics": { "total_people": 4, "vulnerable_groups": [ "Infant (< 1 yr)", "Elderly with chronic medication needs (insulin)" ] }, "resources_required": [ { "category": "boat_rescue", "urgency": "critical", "details": "Watercraft rescue team with pediatric flotation gear" }, { "category": "medical", "urgency": "critical", "details": "Emergency paramedic dispatch + rapid refrigerated insulin" } ], "hazards_identified": [ "Rapidly rising floodwaters cut off ground egress" ], "human_verification_recommended": true, "human_verification_notes": "Validate access route safety and watercraft clearance before entering sector." } - 运行截图:

复现方式 / Reproduction Steps
- 代码仓库 / Code Repo: https://github.com/deamybro/RescueLens-Spark-X2.6 (MIT License)
- 运行框架及版本 / Runtime & Framework:
- Python 3.13.2
transformers/huggingface_hub/llama-cpp-pythoncompatiblestreamlit >= 1.57.0,pydantic >= 2.13.5
- 硬件与精度 / 量化方式 / Hardware & Quantization:
- 测试硬件环境: Intel CPU / Intel HD Graphics 520, 8 GB RAM, Windows 11
- 推理量化模式:
Spark-X2.6-4B-GGUF(Q4_K_M 4-bit, ~2.5GB 内存占用) 或 Hugging Face 离线加速运行时
- 本地启动与复现步骤 / Install & Run Steps:
git clone <repo_url> cd spark-x2.6-bounty pip install -r requirements.txt python -m unittest tests/test_engine.py streamlit run src/app.py
效果与局限 / Evaluation & Limitations
- 已观察到的效果及评估方式 / Observed Results:
- 在 Flood, Earthquake, Wildfire, Shelter Logistics 多个典型灾难测试样本集上完成 100% 结构化测试验证 (
Ran 2 tests in 0.001s, OK)。 - 成功从混乱文本中抽离微观地标与物资等级,无缝滤除情绪杂音。
- 在 Flood, Earthquake, Wildfire, Shelter Logistics 多个典型灾难测试样本集上完成 100% 结构化测试验证 (
- 失败案例与当前局限 / Failure Cases & Limitations:
- 坐标精度局限:模型依赖文本内的地名消歧;若求助者仅描述“我家门口大树”,无法在无外部地图 GIS API 联动下定位经纬度。
- **伦理与人工介入边界 (Human-in-the-Loop):本系统定位为调度员的认知增强助手 (Decision Support)**,严禁全自动调度真实救灾警力;系统默认开启
human_verification_recommended=true,重大警情出警前必须由值班调度员人工复核。
贡献者与披露 / Contributors & Disclosures
- 个人 / 团队 / Entry Type: 个人参赛 (Individual entry: @deamybro)
- 贡献者个人主页 / Contributor Profile: https://github.com/deamybro
- AI 辅助开发说明 / AI Assistance Disclosure:
- 使用了 AI 编程助手协同搭建 Streamlit 前端界面、单元测试脚手架及自动化截图脚本;所有架构设计、提示词工程(Prompting)、救灾分级业务逻辑均经过人工验证与确认。
- AI 仅作为开发辅助工具,并非参赛成员。
- 数据来源与授权说明 / Data Licensing:
- 所有测试求救文本均为基于公开人道主义救援案例与模拟危机数据集脱敏编写的合成样本(Synthetic Emergency Data),不涉及任何真实个人隐私或保密出警记录。