Views
No views yet

chandra-FP8-Latest is an FP8-compressed evolution built on top of datalab-to/chandra. This variant leverages BF16 · FP8 (F8_E4M3) precision formats to significantly reduce memory footprint and improve inference efficiency while preserving the high-precision OCR and layout-aware reasoning capabilities of the original architecture. The result is a highly efficient document intelligence vision-language model optimized for complex parsing, structured output generation, and production-scale deployment.
"ocr_layout"max_output_tokens up to 8192 per page1from transformers import Qwen3VLForConditionalGeneration, AutoProcessor
2from qwen_vl_utils import process_vision_info
3import torch
4
5# Load the FP8-compressed chandra model
6model = Qwen3VLForConditionalGeneration.from_pretrained(
7 "prithivMLmods/chandra-FP8",
8 torch_dtype="auto",
9 device_map="auto"
10)
11
12processor = AutoProcessor.from_pretrained(
13 "prithivMLmods/chandra-FP8"
14)
15
16messages = [
17 {
18 "role": "user",
19 "content": [
20 {
21 "type": "image",
22 "image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
23 },
24 {"type": "text", "text": "Analyze the fine-grained details in this image."},
25 ],
26 }
27]
28
29text = processor.apply_chat_template(
30 messages, tokenize=False, add_generation_prompt=True
31)
32
33image_inputs, video_inputs = process_vision_info(messages)
34
35inputs = processor(
36 text=[text],
37 images=image_inputs,
38 videos=video_inputs,
39 padding=True,
40 return_tensors="pt",
41).to("cuda")
42
43generated_ids = model.generate(**inputs, max_new_tokens=256)
44
45generated_ids_trimmed = [
46 out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
47]
48
49output_text = processor.batch_decode(
50 generated_ids_trimmed,
51 skip_special_tokens=True,
52 clean_up_tokenization_spaces=False
53)
54
55print(output_text)