Instructions to use elifepathways/jats-agentic-annotation-qwen3.5-9b-teacher-distill-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use elifepathways/jats-agentic-annotation-qwen3.5-9b-teacher-distill-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="elifepathways/jats-agentic-annotation-qwen3.5-9b-teacher-distill-v1") 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("elifepathways/jats-agentic-annotation-qwen3.5-9b-teacher-distill-v1") model = AutoModelForMultimodalLM.from_pretrained("elifepathways/jats-agentic-annotation-qwen3.5-9b-teacher-distill-v1", 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 elifepathways/jats-agentic-annotation-qwen3.5-9b-teacher-distill-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "elifepathways/jats-agentic-annotation-qwen3.5-9b-teacher-distill-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "elifepathways/jats-agentic-annotation-qwen3.5-9b-teacher-distill-v1", "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/elifepathways/jats-agentic-annotation-qwen3.5-9b-teacher-distill-v1
- SGLang
How to use elifepathways/jats-agentic-annotation-qwen3.5-9b-teacher-distill-v1 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 "elifepathways/jats-agentic-annotation-qwen3.5-9b-teacher-distill-v1" \ --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": "elifepathways/jats-agentic-annotation-qwen3.5-9b-teacher-distill-v1", "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 "elifepathways/jats-agentic-annotation-qwen3.5-9b-teacher-distill-v1" \ --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": "elifepathways/jats-agentic-annotation-qwen3.5-9b-teacher-distill-v1", "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 elifepathways/jats-agentic-annotation-qwen3.5-9b-teacher-distill-v1 with Docker Model Runner:
docker model run hf.co/elifepathways/jats-agentic-annotation-qwen3.5-9b-teacher-distill-v1
JATS agentic annotation โ Qwen3.5-9B teacher-distilled LoRA (v1, "tfull")
Full merged weights (Qwen3.5-9B + teacher-distilled LoRA) for a multi-turn tool-call agent emitting JATS XML for scientific-paper body sections via the scratchpad environment in agentic-jats-annotation-inference.
These are ready-to-serve full weights (LoRA already merged onto the v11 SFT
base). The raw adapter is also included under lora_adapter/ โ if you use it
instead, apply it on top of the v11 SFT merge, NOT raw Qwen3.5-9B (measured:
0.234 vs 0.452 pass@6 body F).
Training
- Teacher: DeepSeek-v4-pro driven turn-by-turn through the 17-tool JatsEnv on
sup/sub-preserving markdown (docling + custom run/footnote/ins fixes);
1,549 rollouts over 800 docs (
$250 API), filtered to best-per-doc with F0.5 โฅ 0.45 and recall โฅ 0.30 (430 trajectories). - SFT: LoRA r32/ฮฑ64, lr 2e-5, 2 epochs, max-length 16384, assistant-token masking, bf16, sdpa attention (flash_attn_2 crashes on this architecture).
Evaluation (77-doc fixed body slice, strict exact-match metric, pass@6 @ T=0.9)
| model | plain F | + candidate merge | median F | mean single-rollout F |
|---|---|---|---|---|
| v11 SFT base | 0.336 | 0.511 | 0.258 | 0.172 |
| + 215-doc teacher SFT | 0.372 | 0.536 | 0.340 | 0.148 |
| this adapter (~430 docs) | 0.452 | 0.595 | 0.488 | 0.180 |
Paired vs base: +0.118 (95% CI +0.067..+0.169). Perfect-play ceiling under
this metric is 0.842. "Candidate merge" = deterministic DOCX-style-run and
regex-citation candidates union-merged post-hoc at serialize time
(scripts/candidate_merge.py in the training repo); recommended in
production. PDF-sourced inputs score lower (โ0.16 plain).
Serving
vLLM โฅ 0.19, --max-model-len 41472, thinking mode ON, temp 0.7โ0.9;
stop on </tool_call>, one call per turn, env owns the XML tree. See the
inference repo for the full annotation loop. Eval evidence:
eval_passk_tfull_v2slice.json (per-doc f_lists + full traces).
Per-tag evidence (also in this repo)
eval_pertag_comparison.jsonโ base/tpwarm/tfull with paired bootstrap CIs (tfull vs base: +0.118 [+0.066,+0.172] plain; docx 0.487/0.632, pdf 0.294/0.429).eval_pertag_by_tag.jsonโ per-JATS-tag P/R/F1 of best rollouts, with and without candidate merge. Highlights (F1, plain โ merged): sub 0.00 โ 0.95, sup 0.34 โ 0.54, xref 0.33 โ 0.65.
Note for LoRA-only users: adapter_config.json:base_model_name_or_path refers
to a local training path; the required base is the v11 scratchpad-SFT merge of
Qwen/Qwen3.5-9B described above (not distributed here โ contact the authors,
or use the merged weights release when available).
- Downloads last month
- 10