Image-Text-to-Text
Transformers
Safetensors
English
Chinese
qwen3_5
qwen3.5
decision-model
structured-prediction
text-classification
conversational
Instructions to use PelaAI/KnowLine-2B-Gen1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PelaAI/KnowLine-2B-Gen1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="PelaAI/KnowLine-2B-Gen1") 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("PelaAI/KnowLine-2B-Gen1") model = AutoModelForMultimodalLM.from_pretrained("PelaAI/KnowLine-2B-Gen1", 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 PelaAI/KnowLine-2B-Gen1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PelaAI/KnowLine-2B-Gen1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PelaAI/KnowLine-2B-Gen1", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/PelaAI/KnowLine-2B-Gen1
- SGLang
How to use PelaAI/KnowLine-2B-Gen1 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 "PelaAI/KnowLine-2B-Gen1" \ --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": "PelaAI/KnowLine-2B-Gen1", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "PelaAI/KnowLine-2B-Gen1" \ --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": "PelaAI/KnowLine-2B-Gen1", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use PelaAI/KnowLine-2B-Gen1 with Docker Model Runner:
docker model run hf.co/PelaAI/KnowLine-2B-Gen1
|
Download INFERENCE.md from PelaAI/KnowLine-2B-Gen1: direct link, hf CLI and curl.
- Browser
- Download file 2.57 kB
-
https://huggingface.co/PelaAI/KnowLine-2B-Gen1/resolve/main/INFERENCE.md
- Command line
-
hf download hf://PelaAI/KnowLine-2B-Gen1/INFERENCE.md
-
curl -L -o INFERENCE.md https://huggingface.co/PelaAI/KnowLine-2B-Gen1/resolve/main/INFERENCE.md
2.57 kB
KnowLine-2B-Gen1: serving and Decision Index run
The model reads option-label probabilities directly; it does not generate free-form answers.
Weights
- Base: Qwen3.5-2B.
- One epoch of LoRA SFT (rank 32, alpha 64, language-model linear layers only), merged into bf16 weights; the released checkpoint is the end of training.
- Readout temperature T = 1.32, fitted on held-out data, folded into
model.language_model.norm.weight(CALIBRATION.json). Do not apply it a second time: the front end reads at temperature 1. temperatures.json:{"score": 0.7576}divides score-question logits by 0.7576 (= 1/1.32), so score questions are read at an effective temperature of 1.0; choice and yes/no questions keep T = 1.32.
Software
serve_knowline.sh: starts SGLang 0.5.21 in bf16 (--mem-fraction-static 0.85,--enable-fp32-lm-head,--mamba-radix-cache-strategy extra_buffer), thenknowline_server.pywith temperature 1, 16 scoring workers,--temperatures temperatures.json.knowline_server.py: the/v1/systemoneHTTP server;knowline_layout.py: prompt layout and read twice;knowline_engine.py: the same front end in process, for the Decision Index kit.- Prompts use the Qwen3.5 chat template with thinking turned off (
enable_thinking=False). The chat template in this repository turns thinking on by default.
Read twice
For a text-only request whose one-pass length is at most 3,000 tokens, the front end writes the input a second time
before the answer position; the second copy starts with Read the same input again before answering:. Longer requests
and requests with images are read once. --no-read-twice turns this off.
Launch
bash serve_knowline.sh /path/to/KnowLine-2B-Gen1 0 8080
Without SGLang (transformers, slower):
python knowline_server.py --model PelaAI/KnowLine-2B-Gen1 --backend hf --port 8080 --temperatures temperatures.json
Decision Index run
- Kit: Decision Index 0.3 public suite, official kit at commit
62d2f51, scored 2026-10-29. - Serving: four identical H20 servers started with
serve_knowline.shfrom this repository's files, one GPU each, and 32 client shards spread over them. - Result: public index 52.23, raw 64.24; 140,620 requests, 140,178 scoreable, all answered, none unsupported or truncated, no errors, no retries.
- Latency: 300 random requests sent one at a time to one server after a warm-up: 30.0 ms median, 60.6 ms mean, 214.9 ms at the 95th percentile.
Hardware
NVIDIA H20 (96 GB). Not the board's reference hardware.