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/start-all.js from masterofthestars/tianxuan: direct link, hf CLI and curl.
- Browser
- Download file 3.73 kB
-
https://huggingface.co/masterofthestars/tianxuan/resolve/main/scripts/start-all.js
- Command line
-
hf download hf://masterofthestars/tianxuan/scripts/start-all.js
-
curl -L -o start-all.js https://huggingface.co/masterofthestars/tianxuan/resolve/main/scripts/start-all.js
3.73 kB
| /** | |
| * 天玄一键启用所有模块脚本 | |
| * | |
| * 用法: | |
| * node scripts/start-all.js # 从头训练 | |
| * node scripts/start-all.js --resume=path # 从 checkpoint 续训 | |
| * node scripts/start-all.js --test # 仅测试生成 | |
| */ | |
| const { execSync } = require('child_process'); | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| const args = process.argv.slice(2); | |
| const resumeArg = args.find(a => a.startsWith('--resume=')); | |
| const resumeDir = resumeArg ? resumeArg.split('=')[1] : null; | |
| const testOnly = args.includes('--test'); | |
| console.log(` | |
| ╔═══════════════════════════════════════════════════════════╗ | |
| ║ 天玄 TianXuan - 一键启用所有模块 ║ | |
| ╠═══════════════════════════════════════════════════════════╣ | |
| ║ 多神经协同 | MoE | Titans | STDP | STDA | 重放 ║ | |
| ╚═══════════════════════════════════════════════════════════╝ | |
| `); | |
| // 1. 编译 | |
| console.log('📦 编译中...'); | |
| try { | |
| execSync('npm run build', { stdio: 'inherit' }); | |
| console.log('✅ 编译成功\n'); | |
| } catch (e) { | |
| console.error('❌ 编译失败'); | |
| process.exit(1); | |
| } | |
| // 2. 检查数据 | |
| const rawDir = 'data/raw'; | |
| if (fs.existsSync(rawDir)) { | |
| const files = fs.readdirSync(rawDir).filter(f => f.endsWith('.txt')); | |
| let totalBytes = 0; | |
| for (const f of files) { | |
| totalBytes += fs.statSync(path.join(rawDir, f)).size; | |
| } | |
| console.log(`📊 训练数据: ${files.length} 个文件, ${totalBytes.toLocaleString()} 字节\n`); | |
| } | |
| // 3. 训练或测试 | |
| if (testOnly) { | |
| console.log('🧪 测试模式: 仅生成示例'); | |
| const checkpoint = resumeDir || 'sandbox/ck-prod-3ep'; | |
| if (!fs.existsSync(checkpoint)) { | |
| console.error(`❌ Checkpoint not found: ${checkpoint}`); | |
| process.exit(1); | |
| } | |
| try { | |
| execSync(`node sandbox/dist/ml/generate.js --checkpoint=${checkpoint} --prompt=小明 --len=30 --temp=0.3 --topk=5`, { stdio: 'inherit' }); | |
| } catch (e) { | |
| console.error('❌ 生成失败'); | |
| } | |
| } else { | |
| const checkpoint = resumeDir || 'sandbox/ck-prod-3ep'; | |
| const resumeFlag = resumeDir ? `--resume=${checkpoint}` : ''; | |
| console.log(`🚀 开始训练${resumeDir ? ' (续训)' : ' (新训练)'}...`); | |
| console.log(` Checkpoint: ${checkpoint}`); | |
| console.log(` 预计时间: ~30 分钟 (CPU)\n`); | |
| try { | |
| execSync(`npm run train -- --epochs=10 --realcorpus=1 --realTokens=1000000 --out=${checkpoint} --ckpt=100 ${resumeFlag}`, { | |
| stdio: 'inherit', | |
| timeout: 3600000 // 60分钟超时 | |
| }); | |
| console.log('\n✅ 训练完成!'); | |
| } catch (e) { | |
| console.log('\n⚠️ 训练超时或中断,但 checkpoint 已保存'); | |
| } | |
| // 4. 验证 | |
| console.log('\n🔍 验证在线学习机制...'); | |
| try { | |
| execSync(`node sandbox/dist/ml/verify-online-learning.js ${checkpoint}`, { stdio: 'inherit' }); | |
| } catch (e) { | |
| console.error('❌ 验证失败'); | |
| } | |
| // 5. 生成测试 | |
| console.log('\n📝 生成质量测试...'); | |
| try { | |
| execSync(`node sandbox/dist/ml/generate.js --checkpoint=${checkpoint} --prompt=小明 --len=50 --temp=0.3 --topk=5`, { stdio: 'inherit' }); | |
| } catch (e) { | |
| console.error('❌ 生成测试失败'); | |
| } | |
| } | |
| console.log('\n✨ 完成!'); | |
| const finalCheckpoint = resumeDir || 'sandbox/ck-prod-3ep'; | |
| console.log(`\n📁 Checkpoint: ${finalCheckpoint}`); | |
| console.log('📊 报告: docs/FINAL-REPORT.md'); | |