Text Generation
Transformers
Safetensors
Chinese
qwen3_5
image-text-to-text
rewrite2
novel-rewrite
qwen3.5
4b
fp8
conversational
modelopt
Run this model with HF Jobs
Run beileng/rewrite2-4b-fp8 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-4b-fp8. 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-4b-fp8 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-4b-fp8. 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-4b-fp8. 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-4b-fp8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use beileng/rewrite2-4b-fp8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="beileng/rewrite2-4b-fp8") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("beileng/rewrite2-4b-fp8") model = AutoModelForMultimodalLM.from_pretrained("beileng/rewrite2-4b-fp8", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use beileng/rewrite2-4b-fp8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "beileng/rewrite2-4b-fp8" # 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-4b-fp8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/beileng/rewrite2-4b-fp8
- SGLang
How to use beileng/rewrite2-4b-fp8 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-4b-fp8" \ --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-4b-fp8", "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-4b-fp8" \ --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-4b-fp8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use beileng/rewrite2-4b-fp8 with Docker Model Runner:
docker model run hf.co/beileng/rewrite2-4b-fp8
北棱 commited on
rename: remove v125 from model names
Browse files57 unmodified lines5859606162636434 unmodified lines9910010110210310410510610710857 unmodified lines## 快速开始(vLLM)```bashvllm serve /path/to/rewrite2-4B-v125-fp8 \--served-model-name rewrite2-4b-fp8 \--trust-remote-code \--max-model-len 4096 \34 unmodified lines| 格式 | 体积 | Hugging Face | ModelScope ||---|---:|---|---|| BF16 合并 | 8.47 GiB | [rewrite2-4b-v125-bf16](https://huggingface.co/aikexue170/rewrite2-4b-v125-bf16) | [rewrite2-4b-v125-bf16](https://modelscope.cn/models/alkaid55555/rewrite2-4b-v125-bf16) || FP8 W8A8 | 5.15 GiB | [rewrite2-4b-v125-fp8](https://huggingface.co/aikexue170/rewrite2-4b-v125-fp8) | [rewrite2-4b-v125-fp8](https://modelscope.cn/models/alkaid55555/rewrite2-4b-v125-fp8) || NVFP4 W4A4 | 3.70 GiB | [rewrite2-4b-v125-nvfp4](https://huggingface.co/aikexue170/rewrite2-4b-v125-nvfp4) | [rewrite2-4b-v125-nvfp4](https://modelscope.cn/models/alkaid55555/rewrite2-4b-v125-nvfp4) || GGUF Q8_0 / Q4_K_M | 4.48 GB / 2.71 GB | [rewrite2-4b-v125-gguf](https://huggingface.co/aikexue170/rewrite2-4b-v125-gguf) | [rewrite2-4b-v125-gguf](https://modelscope.cn/models/alkaid55555/rewrite2-4b-v125-gguf) |4B 是独立实验线,和 27B Rewrite2 权重不通用;27B 见 [rewrite2-27b-bf16](https://huggingface.co/aikexue170/rewrite2-27b-bf16)。57 unmodified lines5859606162636434 unmodified lines9910010110210310410510610710857 unmodified lines## 快速开始(vLLM)```bashvllm serve /path/to/rewrite2-4B-fp8 \--served-model-name rewrite2-4b-fp8 \--trust-remote-code \--max-model-len 4096 \34 unmodified lines| 格式 | 体积 | Hugging Face | ModelScope ||---|---:|---|---|| BF16 合并 | 8.47 GiB | [rewrite2-4b-bf16](https://huggingface.co/aikexue170/rewrite2-4b-bf16) | [rewrite2-4b-bf16](https://modelscope.cn/models/alkaid55555/rewrite2-4b-bf16) || FP8 W8A8 | 5.15 GiB | [rewrite2-4b-fp8](https://huggingface.co/aikexue170/rewrite2-4b-fp8) | [rewrite2-4b-fp8](https://modelscope.cn/models/alkaid55555/rewrite2-4b-fp8) || NVFP4 W4A4 | 3.70 GiB | [rewrite2-4b-nvfp4](https://huggingface.co/aikexue170/rewrite2-4b-nvfp4) | [rewrite2-4b-nvfp4](https://modelscope.cn/models/alkaid55555/rewrite2-4b-nvfp4) || GGUF Q8_0 / Q4_K_M | 4.48 GB / 2.71 GB | [rewrite2-4b-gguf](https://huggingface.co/aikexue170/rewrite2-4b-gguf) | [rewrite2-4b-gguf](https://modelscope.cn/models/alkaid55555/rewrite2-4b-gguf) |4B 是独立实验线,和 27B Rewrite2 权重不通用;27B 见 [rewrite2-27b-bf16](https://huggingface.co/aikexue170/rewrite2-27b-bf16)。
README.md+5-5