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 src/ml/debug-quality.ts from masterofthestars/tianxuan: direct link, hf CLI and curl.
- Browser
- Download file 2.74 kB
-
https://huggingface.co/masterofthestars/tianxuan/resolve/main/src/ml/debug-quality.ts
- Command line
-
hf download hf://masterofthestars/tianxuan/src/ml/debug-quality.ts
-
curl -L -o debug-quality.ts https://huggingface.co/masterofthestars/tianxuan/resolve/main/src/ml/debug-quality.ts
2.74 kB
| import * as fs from "fs"; | |
| import * as path from "path"; | |
| import { Engine } from "./engine"; | |
| async function main(): Promise<void> { | |
| const engine = Engine.load(path.resolve("data/checkpoints")); | |
| console.log("=== MODEL QUALITY CHECK ==="); | |
| console.log("Vocab size:", engine.tokenizer.vocabSize); | |
| console.log("Context window:", engine.model.cfg.ctx); | |
| console.log("Embedding dim:", engine.model.cfg.emb); | |
| console.log("Hidden dim:", engine.model.cfg.hidden); | |
| // Test with a simple prompt | |
| const prompt = "小明"; | |
| const promptIds = engine.tokenizer.encode(prompt); | |
| console.log("\nPrompt:", prompt); | |
| console.log("Prompt IDs:", promptIds); | |
| // Reset state and advance with prompt | |
| (engine as any).state = (engine as any).model.newState(); | |
| for (const id of promptIds) (engine as any).advance(id); | |
| // Peek logits | |
| const logits = (engine as any).peekLogits(4); | |
| const probs = engine.model.logitsToProbs(logits); | |
| // Top 10 predictions | |
| const sorted = Array.from(probs) | |
| .map((p, i) => ({ id: i, prob: p, char: engine.tokenizer.charOf(i) })) | |
| .sort((a, b) => b.prob - a.prob) | |
| .slice(0, 10); | |
| console.log("\nTop 10 predictions after '小明':"); | |
| sorted.forEach((s, i) => { | |
| console.log(` ${i + 1}. "${s.char}" (id=${s.id}): ${(s.prob * 100).toFixed(1)}%`); | |
| }); | |
| // Generate with very low temperature for deterministic output | |
| console.log("\n=== GENERATION (temp=0.1, topK=3) ==="); | |
| const res1 = await engine.generate({ prompt, maxLen: 20, budget: 3, temperature: 0.1, topK: 3 }); | |
| console.log("Output:", res1.text); | |
| console.log("Routes:", res1.routes.map(r => `${r.char}(L${r.depth},conf=${r.confidence.toFixed(2)})`).join(" ")); | |
| // Generate with temperature=0 | |
| console.log("\n=== GENERATION (temp=0.01, topK=1) ==="); | |
| const res2 = await engine.generate({ prompt, maxLen: 20, budget: 3, temperature: 0.01, topK: 1 }); | |
| console.log("Output:", res2.text); | |
| console.log("Routes:", res2.routes.map(r => `${r.char}(L${r.depth},conf=${r.confidence.toFixed(2)})`).join(" ")); | |
| // Generate with temperature=0.5 | |
| console.log("\n=== GENERATION (temp=0.5, topK=10) ==="); | |
| const res3 = await engine.generate({ prompt, maxLen: 30, budget: 3, temperature: 0.5, topK: 10 }); | |
| console.log("Output:", res3.text); | |
| console.log("Routes:", res3.routes.map(r => `${r.char}(L${r.depth},conf=${r.confidence.toFixed(2)})`).join(" ")); | |
| // Test with different prompts | |
| const prompts = ["如果", "美好", "苹果"]; | |
| for (const p of prompts) { | |
| console.log(`\n=== Prompt: "${p}" (temp=0.1, topK=3) ===`); | |
| const r = await engine.generate({ prompt: p, maxLen: 15, budget: 3, temperature: 0.1, topK: 3 }); | |
| console.log("Output:", r.text); | |
| } | |
| } | |
| main().catch(err => console.error(err)); | |