Image-Text-to-Text
Transformers
Safetensors
English
qwen3_5
pathology
histopathology
toxicologic-pathology
toxicology
rodent
decision-model
vision-language
vlm
decision-vlm
calibration
jev
system-one
typed-decisions
calibrated-probabilities
conversational
Eval Results (legacy)
Instructions to use lighteternal/tissuedecision-9b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lighteternal/tissuedecision-9b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="lighteternal/tissuedecision-9b") 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("lighteternal/tissuedecision-9b") model = AutoModelForMultimodalLM.from_pretrained("lighteternal/tissuedecision-9b", 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 lighteternal/tissuedecision-9b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lighteternal/tissuedecision-9b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lighteternal/tissuedecision-9b", "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/lighteternal/tissuedecision-9b
- SGLang
How to use lighteternal/tissuedecision-9b 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 "lighteternal/tissuedecision-9b" \ --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": "lighteternal/tissuedecision-9b", "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 "lighteternal/tissuedecision-9b" \ --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": "lighteternal/tissuedecision-9b", "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 lighteternal/tissuedecision-9b with Docker Model Runner:
docker model run hf.co/lighteternal/tissuedecision-9b
Rename to TissueDecision-9B: card, tissuedecision_config.json, tissuedecision_server.py, usage_example.py, charts; remove toxdecision_* files
93f1465 verified Download usage_example.py from lighteternal/tissuedecision-9b: direct link, hf CLI and curl.
- Browser
- Download file 2.23 kB
-
https://huggingface.co/lighteternal/tissuedecision-9b/resolve/main/usage_example.py
- Command line
-
hf download hf://lighteternal/tissuedecision-9b/usage_example.py
-
curl -L -o usage_example.py https://huggingface.co/lighteternal/tissuedecision-9b/resolve/main/usage_example.py
2.23 kB
| """TissueDecision-9B with llm2jev: one forward pass per question, label-token probabilities (no text generation). | |
| Start the model first (any GPU with >= 24 GB): | |
| vllm serve lighteternal/tissuedecision-9b --max-logprobs 256 --return-tokens-as-token-ids --enable-scale-out \ | |
| --enable-prefix-caching --max-model-len 16384 --default-chat-template-kwargs '{"enable_thinking": false}' | |
| Then: pip install "llm2jev[vision]==0.6.1" and python usage_example.py lesion_tile.jpg "Rat liver, H&E" | |
| (`prepare_image` comes from tissuedecision_server.py in the model repo: it resizes to the training pixel budget.) | |
| """ | |
| import json | |
| import os | |
| import sys | |
| from llm2jev import LLM2Jev | |
| from llm2jev.backends import VLLM | |
| from transformers import AutoProcessor | |
| from tissuedecision_server import prepare_image | |
| MODEL = os.environ.get("TISSUEDECISION_MODEL", "lighteternal/tissuedecision-9b") | |
| QUESTIONS = { | |
| "lesion": {"type": "noul", "instructions": "Is there any histopathological lesion (abnormal finding) in this image?"}, | |
| "finding": {"type": "choice", "instructions": "What is the primary histopathological finding in this image?", | |
| "criteria": {"necrosis": None, "single cell necrosis": None, "inflammatory cell infiltrate": None, | |
| "hemorrhage": None, "vacuolation": None, "no significant findings": None}}, | |
| "organ": {"type": "choice", "instructions": "Which organ is shown?", | |
| "criteria": {"liver": None, "kidney": None, "thyroid gland": None, "testis": None, "urinary bladder": None, | |
| "lung": None, "heart": None, "stomach": None, "salivary gland": None}}, | |
| } | |
| if __name__ == "__main__": | |
| image = sys.argv[1] if len(sys.argv) > 1 else "lesion_tile.jpg" | |
| context = sys.argv[2] if len(sys.argv) > 2 else None # e.g. "Rat liver, H&E"; optional | |
| jev = LLM2Jev(AutoProcessor.from_pretrained(MODEL), VLLM("http://localhost:8000", MODEL), temperature=1.0) | |
| content = [{"type": "image", "image": prepare_image(image)}] + ([{"type": "text", "text": context}] if context else []) | |
| answers = jev([{"role": "user", "content": content}], QUESTIONS) # raw probabilities (calibration: see the server) | |
| print(json.dumps(answers, indent=1)) | |