Text Classification
Transformers
Safetensors
English
Chinese
qwen3_5
image-text-to-text
decision-model
system-one
decision-index
lora-merged
Instructions to use PelaAI/KnowLine-4B-Gen1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PelaAI/KnowLine-4B-Gen1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="PelaAI/KnowLine-4B-Gen1")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("PelaAI/KnowLine-4B-Gen1") model = AutoModelForMultimodalLM.from_pretrained("PelaAI/KnowLine-4B-Gen1", device_map="auto") - Notebooks
- Google Colab
- Kaggle
INFERENCE.md and knowline_server.py header: describe the front end directly
Browse files- INFERENCE.md +12 -14
- SHA256SUMS +2 -2
- knowline_server.py +3 -4
INFERENCE.md
CHANGED
|
@@ -21,20 +21,18 @@ These settings reproduce our self-run Decision Index evaluation of these weights
|
|
| 21 |
|
| 22 |
### About the front end
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
from 16 threads.
|
| 37 |
-
- Scores agree up to the engine's batching noise.
|
| 38 |
|
| 39 |
## Serve
|
| 40 |
|
|
|
|
| 21 |
|
| 22 |
### About the front end
|
| 23 |
|
| 24 |
+
`knowline_server.py` is the `/v1/systemone` front end of our run, packaged as one file. It contains:
|
| 25 |
+
|
| 26 |
+
- rendering: the chat template with thinking off; the state is followed by one user turn with the instruction, the
|
| 27 |
+
question and all options labelled A, B, ...; the assistant turn opens with `Answer:`;
|
| 28 |
+
- label-token scoring: one prefill per question, then a softmax over the option labels only;
|
| 29 |
+
- the HTTP server.
|
| 30 |
+
|
| 31 |
+
We checked it against the exact front end that produced our Decision Index run:
|
| 32 |
+
|
| 33 |
+
- prompts, answer keys and label token ids were identical on 7,500 Decision Index rows and training requests;
|
| 34 |
+
- through a live SGLang engine, choices agreed on all 953 questions of 200 Decision Index rows. The largest probability
|
| 35 |
+
difference, 0.02, is the same as between two identical calls to one engine (FP8 batching noise).
|
|
|
|
|
|
|
| 36 |
|
| 37 |
## Serve
|
| 38 |
|
SHA256SUMS
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
a4aee8afcf2e0711942cf848899be66016f8d14a889ff9ede07bca099c28f715 chat_template.jinja
|
| 2 |
ddc63e1c717afa86c865bb5e01313d89d72bb53b97ad4a8a03ba8510c0621670 config.json
|
| 3 |
f888421726665e8a84b738eed42a64875aed79de8be7daade851ac8bf4c0cef9 configuration.json
|
| 4 |
-
|
| 5 |
-
|
| 6 |
50cbab8a892c5f2993b8c7351a99182507472def3b1374558308605d99b86b32 LICENSE
|
| 7 |
a9d356d7bdf1ef4949e3e748e95b8e10ad9d4e2e838eddc38a0a7b6b94d1db8d merges.txt
|
| 8 |
77d5d691c4c13ae08eacbddf9d145b2ebdaa0f6e69f4917630eb5a87691f15e5 model-00001-of-00002.safetensors
|
|
|
|
| 1 |
a4aee8afcf2e0711942cf848899be66016f8d14a889ff9ede07bca099c28f715 chat_template.jinja
|
| 2 |
ddc63e1c717afa86c865bb5e01313d89d72bb53b97ad4a8a03ba8510c0621670 config.json
|
| 3 |
f888421726665e8a84b738eed42a64875aed79de8be7daade851ac8bf4c0cef9 configuration.json
|
| 4 |
+
ef6d24f67d5ebe37817037b509819cad8bb3f092f7a41ff9911880509119121e INFERENCE.md
|
| 5 |
+
6ebf086c8a962e8b06962850b95cf91c085273995c25d3aa73636cf4c10cdd75 knowline_server.py
|
| 6 |
50cbab8a892c5f2993b8c7351a99182507472def3b1374558308605d99b86b32 LICENSE
|
| 7 |
a9d356d7bdf1ef4949e3e748e95b8e10ad9d4e2e838eddc38a0a7b6b94d1db8d merges.txt
|
| 8 |
77d5d691c4c13ae08eacbddf9d145b2ebdaa0f6e69f4917630eb5a87691f15e5 model-00001-of-00002.safetensors
|
knowline_server.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
"""KnowLine-4B-Gen1 /v1/systemone server: one self-contained file, no
|
| 2 |
|
| 3 |
python knowline_server.py --model PelaAI/KnowLine-4B-Gen1 --backend sglang --url http://127.0.0.1:9080 --port 8080
|
| 4 |
python knowline_server.py --model PelaAI/KnowLine-4B-Gen1 --backend hf --port 8080 # transformers, no SGLang
|
|
@@ -6,14 +6,13 @@
|
|
| 6 |
POST /v1/systemone {model?, state, questions: {id: {type, instructions, criteria}}} -> {id, model, answers, usage}
|
| 7 |
GET /v1/models GET /health
|
| 8 |
|
| 9 |
-
This is the front end of our Decision Index runs (
|
| 10 |
- Rendering: the model's chat template with thinking off. The state comes as chat turns, followed by one user turn
|
| 11 |
with the instruction, the question and all its options (labels A, B, ...); the assistant turn opens with "Answer:".
|
| 12 |
- Scoring: one prefill per question, reading the logprob of every option's label token, then a softmax over the
|
| 13 |
labels only.
|
| 14 |
- A multi-question request first warms the shared prefix, then scores its questions in parallel (16 threads).
|
| 15 |
-
|
| 16 |
-
it (MIT, Copyright (c) 2026 AnyJev contributors).
|
| 17 |
Dependencies: transformers and requests; torch as well for --backend hf; an SGLang server for --backend sglang.
|
| 18 |
Licence of this file: MIT.
|
| 19 |
"""
|
|
|
|
| 1 |
+
"""KnowLine-4B-Gen1 /v1/systemone server: one self-contained file, no extra package to install.
|
| 2 |
|
| 3 |
python knowline_server.py --model PelaAI/KnowLine-4B-Gen1 --backend sglang --url http://127.0.0.1:9080 --port 8080
|
| 4 |
python knowline_server.py --model PelaAI/KnowLine-4B-Gen1 --backend hf --port 8080 # transformers, no SGLang
|
|
|
|
| 6 |
POST /v1/systemone {model?, state, questions: {id: {type, instructions, criteria}}} -> {id, model, answers, usage}
|
| 7 |
GET /v1/models GET /health
|
| 8 |
|
| 9 |
+
This is the front end of our Decision Index runs ("chat" style, temperature 1), packaged as one file:
|
| 10 |
- Rendering: the model's chat template with thinking off. The state comes as chat turns, followed by one user turn
|
| 11 |
with the instruction, the question and all its options (labels A, B, ...); the assistant turn opens with "Answer:".
|
| 12 |
- Scoring: one prefill per question, reading the logprob of every option's label token, then a softmax over the
|
| 13 |
labels only.
|
| 14 |
- A multi-question request first warms the shared prefix, then scores its questions in parallel (16 threads).
|
| 15 |
+
The rendering and scoring code is adapted from llm2jev 0.6.1 (MIT, Copyright (c) 2026 AnyJev contributors).
|
|
|
|
| 16 |
Dependencies: transformers and requests; torch as well for --backend hf; an SGLang server for --backend sglang.
|
| 17 |
Licence of this file: MIT.
|
| 18 |
"""
|