Clair's text part decoder-only transformer (LLM).
The image part is a SigLIP image encoder
1FROM ./model-Q4_K_M.gguf
2CLIP_MODEL ./mmproj-model-f16.gguf
3SYSTEM You are Clair, a warm and knowledgeable AI health assistant developed by Michael Nkomo, an AI engineer based in Zimbabwe. You are grounded in Zimbabwe's public health system, Zimbabwean heritage and culture, and Cimas Health Group. You are not a substitute for professional medical advice, diagnosis, or treatment.
4PARAMETER temperature 0.7
5PARAMETER top_k 40
6PARAMETER top_p 0.9
1ollama create clair-health -f Modelfile
2ollama run clair-health
Evaluated on MIMIC-CXR using RadGraph F1.
Clair has been evaluated with structured safety testing and internal red-teaming across text and image inputs. These evaluations covered child safety, content safety, representational harms, and medical safety concerns.
The model was tested without safety filters to better understand raw behavior during evaluation. Results should be interpreted carefully, especially because the evaluation set was primarily English-language prompts.
First, install the Transformers library. Clair-health is supported starting from transformers 4.50.0.
1from transformers import pipeline
2from PIL import Image
3import requests
4import torch
5
6pipe = pipeline(
7 "image-text-to-text",
8 model="clair-health",
9 torch_dtype=torch.bfloat16,
10 device="cuda",
11)
12
13# Image attribution: Stillwaterising, CC0, via Wikimedia Commons
14image_url = "https://upload.wikimedia.org/wikipedia/commons/c/c8/Chest_Xray_PA_3-8-2010.png"
15image = Image.open(requests.get(image_url, headers={"User-Agent": "example"}, stream=True).raw)
16
17messages = [
18 {
19 "role": "system",
20 "content": [{"type": "text", "text": "You are an expert radiologist."}]
21 },
22 {
23 "role": "user",
24 "content": [
25 {"type": "text", "text": "Describe this X-ray"},
26 {"type": "image", "image": image}
27 ]
28 }
29]
30
31output = pipe(text=messages, max_new_tokens=200)
32print(output["generated_text"][-1]["content"])
1from transformers import AutoProcessor, AutoModelForImageTextToText
2from PIL import Image
3import requests
4import torch
5
6model_id = "clair-health"
7
8model = AutoModelForImageTextToText.from_pretrained(
9 model_id,
10 torch_dtype=torch.bfloat16,
11 device_map="auto",
12)
13processor = AutoProcessor.from_pretrained(model_id)
14
15# Image attribution: Stillwaterising, CC0, via Wikimedia Commons
16image_url = "https://upload.wikimedia.org/wikipedia/commons/c/c8/Chest_Xray_PA_3-8-2010.png"
17image = Image.open(requests.get(image_url, headers={"User-Agent": "example"}, stream=True).raw)
18
19messages = [
20 {
21 "role": "system",
22 "content": [{"type": "text", "text": "You are an expert radiologist."}]
23 },
24 {
25 "role": "user",
26 "content": [
27 {"type": "text", "text": "Describe this X-ray"},
28 {"type": "image", "image": image}
29 ]
30 }
31]
32
33inputs = processor.apply_chat_template(
34 messages,
35 add_generation_prompt=True,
36 tokenize=True,
37 return_dict=True,
38 return_tensors="pt",
39).to(model.device, dtype=torch.bfloat16)
40
41input_len = inputs["input_ids"].shape[-1]
42
43with torch.inference_mode():
44 generation = model.generate(**inputs, max_new_tokens=200, do_sample=False)
45 generation = generation[input_len:]
46
47decoded = processor.decode(generation, skip_special_tokens=True)
48print(decoded)
This model is provided for informational and research purposes only. It is an AI assistant, not a substitute for professional medical advice, diagnosis, or treatment.