Views
No views yet

MedMO-8B-FP8 is an FP8-compressed variant built on top of MBZUAI/MedMO-8B. This edition applies BF16 · FP8 (F8_E4M3) precision formats to significantly reduce memory footprint and improve inference throughput while preserving the advanced medical multimodal reasoning and grounding capabilities of the original 8B architecture. The base MedMO-8B model from MBZUAI is an 8B-parameter open-source multimodal large language model built on the Qwen3-VL architecture. It is specialized for comprehensive medical image understanding and grounding across radiology including X-ray, CT, MRI, and ultrasound, as well as pathology, ophthalmology, dermatology, and nuclear medicine.
1from transformers import Qwen3VLForConditionalGeneration, AutoProcessor
2from qwen_vl_utils import process_vision_info
3import torch
4
5# Load the FP8 MedMO model
6model = Qwen3VLForConditionalGeneration.from_pretrained(
7 "MBZUAI/MedMO-8B-FP8",
8 torch_dtype="auto",
9 device_map="auto"
10)
11
12processor = AutoProcessor.from_pretrained(
13 "MBZUAI/MedMO-8B-FP8"
14)
15
16messages = [
17 {
18 "role": "user",
19 "content": [
20 {
21 "type": "image",
22 "image": "medical_scan.png",
23 },
24 {
25 "type": "text",
26 "text": "Identify abnormalities and provide a diagnostic summary."
27 },
28 ],
29 }
30]
31
32text = processor.apply_chat_template(
33 messages, tokenize=False, add_generation_prompt=True
34)
35
36image_inputs, video_inputs = process_vision_info(messages)
37
38inputs = processor(
39 text=[text],
40 images=image_inputs,
41 videos=video_inputs,
42 padding=True,
43 return_tensors="pt",
44).to("cuda")
45
46generated_ids = model.generate(**inputs, max_new_tokens=512)
47
48generated_ids_trimmed = [
49 out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
50]
51
52output_text = processor.batch_decode(
53 generated_ids_trimmed,
54 skip_special_tokens=True,
55 clean_up_tokenization_spaces=False
56)
57
58print(output_text)Important: This model is intended for research and clinical decision support development only.