OpenCompass/opencompass/multimodal/models/visualglm/post_processor.py
Yike Yuan 8d368d1cd6
[Feat] Support visualglm and llava for MMBench evaluation. (#211)
* [Feat] Support visualglm inference on MMBench.

* [Feat] Support llava inference on MMBench.

* [Fix] Fix pre-commit format.

* [Fix] Add docstring for llava

* [Fix] Fix multi-process inference error of LlaVA and add comments.
1. Set `low_cpu_mem_usage` to False to address device issue.
2. Add docstring and type hints.
3. Rename class and remove registry.

* [Fix] Pre-commit fix.

* [Fix] add forward entry, add dynamic import to seedbench

* [Fix] Fix pre-commit.

* [Fix] Fix missing context.

* [Fix] Fix docstring.
2023-08-21 15:57:30 +08:00

15 lines
334 B
Python

from typing import Any
import torch
class VisualGLMPostProcessor:
""""Post processor for VisualGLM on MMBench."""
def __init__(self) -> None:
pass
def __call__(self, output_token: torch.tensor, tokenizer: Any,
input_len: int) -> str:
return tokenizer.decode(output_token[input_len:])