Text Generation
Transformers
Chinese
English
character-level
chinese
gru
mamba
Mixture of Experts
titans
Instructions to use masterofthestars/tianxuan with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use masterofthestars/tianxuan with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="masterofthestars/tianxuan")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("masterofthestars/tianxuan", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use masterofthestars/tianxuan with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "masterofthestars/tianxuan" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "masterofthestars/tianxuan", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/masterofthestars/tianxuan
- SGLang
How to use masterofthestars/tianxuan 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 "masterofthestars/tianxuan" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "masterofthestars/tianxuan", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "masterofthestars/tianxuan" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "masterofthestars/tianxuan", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use masterofthestars/tianxuan with Docker Model Runner:
docker model run hf.co/masterofthestars/tianxuan
Tianxuan: full project + data (checkpoints, world_model, data without raw) with correct directory structure
db7bc06 Download scripts/fix-online-learning.js from masterofthestars/tianxuan: direct link, hf CLI and curl.
- Browser
- Download file 5.72 kB
-
https://huggingface.co/masterofthestars/tianxuan/resolve/main/scripts/fix-online-learning.js
- Command line
-
hf download hf://masterofthestars/tianxuan/scripts/fix-online-learning.js
-
curl -L -o fix-online-learning.js https://huggingface.co/masterofthestars/tianxuan/resolve/main/scripts/fix-online-learning.js
5.72 kB
| /** | |
| * 天玄 TianXuan - 在线学习修复脚本 | |
| * | |
| * 问题诊断: | |
| * 1. 检查点元数据与实际语料不匹配 (1384 vs 1,500,000 字符) | |
| * 2. STDP/STDA 未启用 | |
| * 3. 训练步数严重不足 (仅 4 步) | |
| * 4. 缺乏真实中文语料 | |
| * | |
| * 修复方案: | |
| * 1. 使用真实语料 (corpus_real.txt) | |
| * 2. 启用 STDP + STDA 机制 | |
| * 3. 配置专业训练参数 | |
| * 4. 持续训练直到在线学习稳定 | |
| */ | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| console.log('='.repeat(60)); | |
| console.log('天玄 TianXuan - 在线学习修复工具'); | |
| console.log('='.repeat(60)); | |
| console.log(''); | |
| // 1. 检查语料文件 | |
| console.log('📊 语料文件检查:'); | |
| const corpusFiles = { | |
| 'corpus.txt': 'data/corpus.txt', | |
| 'corpus_real.txt': 'data/corpus_real.txt', | |
| 'corpus_large.txt': 'data/corpus_large.txt' | |
| }; | |
| for (const [name, filepath] of Object.entries(corpusFiles)) { | |
| if (fs.existsSync(filepath)) { | |
| const stats = fs.statSync(filepath); | |
| console.log(` ✓ ${name}: ${(stats.size / 1024 / 1024).toFixed(2)} MB (${stats.size} 字符)`); | |
| } else { | |
| console.log(` ✗ ${name}: 文件不存在`); | |
| } | |
| } | |
| console.log(''); | |
| // 2. 检查当前检查点 | |
| console.log('📦 当前检查点状态:'); | |
| const metaPath = 'checkpoints/meta.json'; | |
| if (fs.existsSync(metaPath)) { | |
| const meta = JSON.parse(fs.readFileSync(metaPath, 'utf8')); | |
| console.log(` 训练步数: ${meta.t || 0}`); | |
| console.log(` 语料长度: ${meta.corpusTokens || 0} 字符`); | |
| console.log(` 词表大小: ${meta.config?.vocabSize || 0}`); | |
| console.log(` STDP: ${meta.stdp ? '✓ 已启用' : '✗ 未启用'}`); | |
| console.log(` STDA: ${meta.stda ? '✓ 已启用' : '✗ 未启用'}`); | |
| console.log(` Titans: ${meta.onlineTitans ? '✓ 已启用' : '✗ 未启用'}`); | |
| console.log(` Replay: ${meta.replay ? '✓ 已启用' : '✗ 未启用'}`); | |
| console.log(` 训练时间: ${meta.trainedAt || '未知'}`); | |
| } else { | |
| console.log(' ✗ 检查点元数据不存在'); | |
| } | |
| console.log(''); | |
| // 3. 推荐修复配置 | |
| console.log('🔧 推荐修复配置:'); | |
| console.log(''); | |
| console.log('【方案 A: 快速验证 (1小时)】'); | |
| console.log(' 语料: corpus_real.txt (前 5MB)'); | |
| console.log(' 参数: emb=64, hidden=128, ctx=8, bptt=16'); | |
| console.log(' 训练: --epochs 3 --tokens 5000000 --stdp 1 --stda 1'); | |
| console.log(' 预期: 1-2 小时完成,验证在线学习机制'); | |
| console.log(''); | |
| console.log('【方案 B: 完整训练 (6-8小时)】'); | |
| console.log(' 语料: corpus_real.txt (完整 48MB)'); | |
| console.log(' 参数: emb=64, hidden=128, ctx=8, bptt=32'); | |
| console.log(' 训练: --epochs 5 --tokens 48000000 --stdp 1 --stda 1'); | |
| console.log(' 预期: 6-8 小时完成,达到生产级质量'); | |
| console.log(''); | |
| console.log('【方案 C: 最小修复 (30分钟)】'); | |
| console.log(' 语料: corpus.txt (现有 1.5MB)'); | |
| console.log(' 参数: 保持当前配置'); | |
| console.log(' 训练: --epochs 10 --tokens 1500000 --stdp 1 --stda 1'); | |
| console.log(' 预期: 30 分钟完成,快速验证 STDP/STDA'); | |
| console.log(''); | |
| // 4. 生成启动命令 | |
| console.log('🚀 一键启动命令:'); | |
| console.log(''); | |
| console.log('# 方案 A - 快速验证 (推荐)'); | |
| console.log('npm run train -- --realcorpus 0 --tokens 5000000 --epochs 3 --stdp 1 --stda 1 --out data/checkpoints_v2'); | |
| console.log(''); | |
| console.log('# 方案 B - 完整训练'); | |
| console.log('npm run train -- --realcorpus 1 --rawdir data --realrawperfile 5000000 --epochs 5 --stdp 1 --stda 1 --out data/checkpoints_v2'); | |
| console.log(''); | |
| console.log('# 方案 C - 最小修复'); | |
| console.log('npm run train -- --realcorpus 0 --tokens 1500000 --epochs 10 --stdp 1 --stda 1 --out data/checkpoints_v2'); | |
| console.log(''); | |
| // 5. 创建诊断报告 | |
| const report = { | |
| timestamp: new Date().toISOString(), | |
| issues: [ | |
| { | |
| id: 'CORPUS_MISMATCH', | |
| severity: 'HIGH', | |
| description: '检查点元数据语料长度与实际不符', | |
| current: '1384 字符', | |
| expected: '≥ 1,500,000 字符', | |
| impact: '导致训练数据严重不足,模型无法学习有效模式' | |
| }, | |
| { | |
| id: 'STDP_OFF', | |
| severity: 'MEDIUM', | |
| description: 'STDP (突触时序依赖可塑性) 未启用', | |
| current: '关闭', | |
| expected: '开启', | |
| impact: '无法实现在线学习的突触权重自适应调整' | |
| }, | |
| { | |
| id: 'STDA_OFF', | |
| severity: 'MEDIUM', | |
| description: 'STDA (突触阈值适应) 未启用', | |
| current: '关闭', | |
| expected: '开启', | |
| impact: '无法实现神经元兴奋性自适应调节' | |
| }, | |
| { | |
| id: 'INSUFFICIENT_STEPS', | |
| severity: 'HIGH', | |
| description: '训练步数严重不足', | |
| current: '4 步', | |
| expected: '≥ 1000 步', | |
| impact: '模型尚未收敛,参数未充分优化' | |
| } | |
| ], | |
| recommendations: [ | |
| '使用真实中文语料 (corpus_real.txt) 替代合成语料', | |
| '启用 STDP + STDA 机制实现真正的在线学习', | |
| '增加训练步数至 1000+ 步', | |
| '使用专业训练参数 (lr=0.0006, warmup=100, batch=64)', | |
| '定期保存检查点并监控训练指标' | |
| ], | |
| nextSteps: [ | |
| '选择修复方案 (A/B/C) 并执行', | |
| '监控训练日志,确认 STDP/STDA 正常工作', | |
| '验证在线学习机制 (记忆巩固、突触适应)', | |
| '对比修复前后生成质量' | |
| ] | |
| }; | |
| const reportPath = 'diagnostics/online-learning-fix-report.json'; | |
| fs.mkdirSync('diagnostics', { recursive: true }); | |
| fs.writeFileSync(reportPath, JSON.stringify(report, null, 2)); | |
| console.log(`✅ 诊断报告已保存: ${reportPath}`); | |
| console.log(''); | |
| console.log('📝 下一步:选择方案 A/B/C 之一启动训练'); | |
| console.log('='.repeat(60)); | |