Skip to content

Commit 032fd36

Browse files
committed
Update docs
1 parent 717c56a commit 032fd36

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

docs/lmms-eval-0.4.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@ LMMS-Eval v0.4 represents a significant evolution in multimodal model evaluation
2525
- [Distributed Evaluation API](#distributed-evaluation-api)
2626
- [Judge API Integration](#judge-api-integration)
2727
- [Batch Processing and Efficiency](#batch-processing-and-efficiency)
28-
- [API Benefits](#api-benefits)
2928
- [New Benchmarks](#new-benchmarks)
3029
- [Vision Understanding](#vision-understanding)
3130
- [Reasoning-Oriented Benchmarks](#reasoning-oriented-benchmarks)
3231
- [Mathematical Reasoning](#mathematical-reasoning)
3332
- [Olympic-Level Challenges](#olympic-level-challenges)
34-
- [Upcoming Benchmarks](#upcoming-benchmarks)
3533
- [Technical Details](#technical-details)
3634
- [Multi-Node Evaluation Architecture](#multi-node-evaluation-architecture)
3735
- [Async OpenAI API Integration](#async-openai-api-integration)
@@ -133,6 +131,19 @@ hf_messages = chat_messages.to_hf_messages()
133131

134132
You can then use these messages with a chat template or the chat completion API. If you wish to implement your own message processing logic, please refer to the protocol definition in `lmms_eval/protocol.py` for more details.
135133

134+
**Replacing the Simple Model with a Chat Model**
135+
136+
To use the `doc_to_messages` function, you must implement a chat model capable of processing the message format it produces. Examples of such models can be found in the `lmms_eval/models/chat` directory.
137+
138+
If you prefer to fall back to the previous simple model implementation, you can add the `--force_simple` flag to the launch command.
139+
140+
To implement a new chat model, follow these steps:
141+
142+
1. Create the chat model (e.g., `lmms_eval/models/vllm.py`).
143+
2. Register the model in `lmms_eval/models/__init__.py`.
144+
145+
146+
136147
### 2. Multi-Node Distributed Evaluation
137148

138149
![Pix-Pin-2025-07-29-23-25-16](https://i.postimg.cc/z88RsDb5/Pix-Pin-2025-07-29-23-25-16.png)

docs/model_guide.md

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,14 @@ class MyImageModel(lmms):
126126
messages = doc_to_messages(doc)
127127

128128
# Process images and text from messages
129-
images = []
129+
images, videos, audios = messages.extract_media()
130130
text_prompt = ""
131131
for message in messages:
132-
if message["type"] == "image":
133-
images.append(message["content"])
134-
elif message["type"] == "text":
135-
text_prompt += message["content"]
132+
if message.type == "text":
133+
text_prompt += message["text"]
134+
135+
# If your model support apply chat template
136+
# text_prompt = self.processor.apply_chat_template(messages.to_hf_messages())
136137

137138
# Prepare inputs for your model
138139
inputs = self.processor(
@@ -188,15 +189,11 @@ class MyVideoModel(lmms):
188189
messages = doc_to_messages(doc)
189190

190191
# Extract video frames
191-
video_frames = []
192+
images, videos, audios = messages.extract_media()
192193
text_prompt = ""
193194
for message in messages:
194-
if message["type"] == "video":
195-
# Process video into frames
196-
frames = self.extract_frames(message["content"], self.max_frames)
197-
video_frames.extend(frames)
198-
elif message["type"] == "text":
199-
text_prompt += message["content"]
195+
if message.type == "text":
196+
text_prompt += message["text"]
200197

201198
# Process video frames and generate response
202199
# ...
@@ -229,16 +226,11 @@ class MyAudioModel(lmms):
229226
doc = self.task_dict[task][split][doc_id]
230227
messages = doc_to_messages(doc)
231228

232-
# Process audio data
233-
audio_data = []
229+
images, videos, audios = messages.extract_media()
234230
text_prompt = ""
235231
for message in messages:
236-
if message["type"] == "audio":
237-
# Load and process audio
238-
audio = self.load_audio(message["content"], self.sample_rate)
239-
audio_data.append(audio)
240-
elif message["type"] == "text":
241-
text_prompt += message["content"]
232+
if message.type == "text":
233+
text_prompt += message["text"]
242234

243235
# Process audio and generate response
244236
# ...

0 commit comments

Comments
 (0)