Text Generation
Transformers
Safetensors
Chinese
qwen3_5_text
rewrite2
novel-rewrite
novel-expansion
chinese
bf16
conversational
Run this model with HF Jobs
Run beileng/rewrite2-27b-bf16 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/beileng/rewrite2-27b-bf16. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/beileng/rewrite2-27b-bf16 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/beileng/rewrite2-27b-bf16. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/beileng/rewrite2-27b-bf16. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use beileng/rewrite2-27b-bf16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use beileng/rewrite2-27b-bf16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="beileng/rewrite2-27b-bf16") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("beileng/rewrite2-27b-bf16") model = AutoModelForCausalLM.from_pretrained("beileng/rewrite2-27b-bf16", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use beileng/rewrite2-27b-bf16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "beileng/rewrite2-27b-bf16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "beileng/rewrite2-27b-bf16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/beileng/rewrite2-27b-bf16
- SGLang
How to use beileng/rewrite2-27b-bf16 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 "beileng/rewrite2-27b-bf16" \ --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": "beileng/rewrite2-27b-bf16", "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 "beileng/rewrite2-27b-bf16" \ --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": "beileng/rewrite2-27b-bf16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use beileng/rewrite2-27b-bf16 with Docker Model Runner:
docker model run hf.co/beileng/rewrite2-27b-bf16
北棱 commited on
rewrite model card: prompts, usage, formats, limits
Browse files17 unmodified lines18192021222324252627282970 unmodified lines10010110210310410515 unmodified lines12112212312412512612712812913013117 unmodified lines> **最佳工作区间:约 1,000 tokens(含固定任务提示词)。** 长文改写前请先按场景或段落切成小段,再逐段输入,能获得最佳效果。不要整章一次性送入;超过这个区间,照抄、复读、跑题和收尾不稳的风险都会上升。## 30 秒判断- **它做什么**:小说文字改写;把删减草稿扩写成完整正文。- **它不做什么**:通用聊天、自由续写、凭空编情节、翻译、跨章节长篇一致性维护。- **怎么调用**:一条 `user` 消息,内容必须是「固定任务提示词 + 正文」,见下一节。- **最佳输入**:单次约 **1,000 tokens**(含固定任务提示词);长文必须先切分,再逐段输入。- **本版定位**:有充足显存,或需要最高精度、继续做二次量化/评测。- **权重与显存**:约 53.8 GB(50.1 GiB);建议 80GB 级。70 unmodified linestemperature=0.7,top_p=0.9,max_tokens=1200,)print(response.choices[0].message.content)15 unmodified lines| top_p | `0.9` || top_k | `50`(llama.cpp / vLLM 支持时) || max_tokens | 改写建议 ≤1200;扩写建议 ≤1600 || 输入长度 | **最佳约 1,000 tokens(含提示词)**;长文不要整章一次性输入 || 长文 | 先按场景/段落切成小段,逐段改写;注意保留必要的人物和场景上下文 |训练时 `max_length=2048` tokens,这是上限而不是最佳工作区间。实际使用以约 **1,000 tokens** 为佳;超过后更容易出现照抄、复读、跑题或收尾不稳。长文请切分后逐段处理,再人工校对衔接。## 格式与显存| 项 | 本仓库 |17 unmodified lines18192021222324252627282930313270 unmodified lines10310410510610710810915 unmodified lines12512612712812913013113213313413513613713817 unmodified lines> **最佳工作区间:约 1,000 tokens(含固定任务提示词)。** 长文改写前请先按场景或段落切成小段,再逐段输入,能获得最佳效果。不要整章一次性送入;超过这个区间,照抄、复读、跑题和收尾不稳的风险都会上升。> **可能出现复读 / 死循环。** 模型不保证自然收尾,可能连续重复短语或整句,直到达到输出上限。部署时必须启用重复惩罚,建议从 `repetition_penalty=1.08` 开始(llama.cpp 对应 `--repeat-penalty 1.08`),同时设置硬性 `max_tokens` 和超时作为兜底。重复惩罚只能降低概率,不能完全消除。## 30 秒判断- **它做什么**:小说文字改写;把删减草稿扩写成完整正文。- **它不做什么**:通用聊天、自由续写、凭空编情节、翻译、跨章节长篇一致性维护。- **怎么调用**:一条 `user` 消息,内容必须是「固定任务提示词 + 正文」,见下一节。- **最佳输入**:单次约 **1,000 tokens**(含固定任务提示词);长文必须先切分,再逐段输入。- **稳定性**:有概率复读或死循环,必须启用重复惩罚(建议从 1.08 起调)并限制输出长度。- **本版定位**:有充足显存,或需要最高精度、继续做二次量化/评测。- **权重与显存**:约 53.8 GB(50.1 GiB);建议 80GB 级。70 unmodified linestemperature=0.7,top_p=0.9,max_tokens=1200,extra_body={"repetition_penalty": 1.08},)print(response.choices[0].message.content)15 unmodified lines| top_p | `0.9` || top_k | `50`(llama.cpp / vLLM 支持时) || max_tokens | 改写建议 ≤1200;扩写建议 ≤1600 || 重复惩罚 | **建议 `repetition_penalty=1.08` 起步**;llama.cpp 使用 `--repeat-penalty 1.08` || 输入长度 | **最佳约 1,000 tokens(含提示词)**;长文不要整章一次性输入 || 长文 | 先按场景/段落切成小段,逐段改写;注意保留必要的人物和场景上下文 |训练时 `max_length=2048` tokens,这是上限而不是最佳工作区间。实际使用以约 **1,000 tokens** 为佳;超过后更容易出现照抄、复读、跑题或收尾不稳。长文请切分后逐段处理,再人工校对衔接。即使设置了重复惩罚,也必须把 `max_tokens` 作为硬上限;仍出现连续复读时,直接截断并重试或更换随机种子。不要只靠降低温度解决死循环。## 格式与显存| 项 | 本仓库 |
README.md+7