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 docs/LINUX-MIGRATION.md from masterofthestars/tianxuan: direct link, hf CLI and curl.
- Browser
- Download file 2.38 kB
-
https://huggingface.co/masterofthestars/tianxuan/resolve/main/docs/LINUX-MIGRATION.md
- Command line
-
hf download hf://masterofthestars/tianxuan/docs/LINUX-MIGRATION.md
-
curl -L -o LINUX-MIGRATION.md https://huggingface.co/masterofthestars/tianxuan/resolve/main/docs/LINUX-MIGRATION.md
2.38 kB
| # 迁移到 Linux (虚拟机重装) | |
| ## 迁移前 (旧 Windows 系统, 关机前) | |
| 从 `C:\Users\l1064\Desktop\tianxuan` 拷出 2 个目录 (总 ~102MB): | |
| | 资产 | 位置 | 大小 | | |
| |---|---|---| | |
| | Transformer 检查点 (批 2310, loss≈3.9, 含 Adam 优化器状态) | `sandbox/data/checkpoints-tf/` | 66MB | | |
| | 真实语料 (11 部古典小说, 1.873M 汉字, 续训必需) | `data/raw/` | 53MB | | |
| 其余源码/文档/脚本已在 Hugging Face (`masterofthestars/tianxuan`); 旧 GitHub `l1064709321/tianxuan` 不再作为主仓库。 | |
| ## 迁移后 (VM Linux, 有网后) | |
| ```bash | |
| # 1. 装 Node ≥ 18 | |
| curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt install -y nodejs # Debian/Ubuntu | |
| # 或: sudo dnf install nodejs # CentOS/RHEL | |
| # 2. 克隆代码 (源码不靠拷贝, 走 Hugging Face 主仓库) | |
| git clone https://huggingface.co/masterofthestars/tianxuan.git | |
| cd tianxuan | |
| npm install | |
| # 3. 把拷出来的 2 个目录放进仓库 | |
| mkdir -p sandbox/data | |
| cp -r /path/to/checkpoints-tf sandbox/data/checkpoints-tf | |
| mkdir -p data | |
| cp -r /path/to/raw data/raw | |
| # 4. 编译 (outDir 必须是 sandbox/dist) | |
| npx tsc --outDir sandbox/dist | |
| # 5. 续训 (接断点, 2M 真实语料, 2 epochs) | |
| node sandbox/dist/ml/train.js --resume sandbox/data/checkpoints-tf \ | |
| --transformer 1 --nlayers 4 --nhead 4 --emb 128 --ctx 32 --bptt 32 \ | |
| --epochs 2 --realTokens 2000000 --out sandbox/data/checkpoints-tf | |
| # 6. 评估 (loss / top-1 / ppl) | |
| cd sandbox && node eval-tf-now.js | |
| ``` | |
| ## 训练监控 | |
| ```bash | |
| # 看最近日志 | |
| tail -f sandbox/data/checkpoints-tf/../../logs/train.log # 或看 console 输出 | |
| # 续训中想加速: 检查点保存默认每 10 批, 可加 --ckpt 500 降低开销 (单 epoch 约 7196 批) | |
| ``` | |
| ## 可选: 推 HuggingFace (VM 能通 huggingface.co 时) | |
| ```bash | |
| export HF_TOKEN=hf_你的token # 旧 token 已在聊天暴露, 建议先去 settings 撤销重发 | |
| export UPLOAD_DATA=1 # 要连 data/ 大检查点一起传就设 1 (默认 0 排除) | |
| bash scripts/upload-to-hf.sh # 详见 docs/HF-UPLOAD.md | |
| ``` | |
| ## 宪章提醒 (AGENTS.md) | |
| - 验证/训练/生成一律在 `sandbox/`, 生产 `data/` 只读 | |
| - 续训命令带 `--out sandbox/data/checkpoints-tf`, 不要漏 (默认 outDir 是生产 `data/checkpoints`) | |
| - 代码零外部依赖 (纯 TS 数值内核), `npm install` 只装 node_modules 基础包 | |