OpenCompass/opencompass/multimodal/models/mplug_owl/post_processor.py
Yuanhan Zhang f2dd98ca7a
[Feat] Support LLaVA and mPLUG-Owl (#331)
* refine gitignore

* [Feature]: Add minigpt-4

* [Feature]: Add mm local runner

* [Feature]: Add instructblip

* add otter and llama-adapter

* add owl

* add llama2-adapter and owl

* lint

* [Feature]: Add minigpt-4

* [Feature]: Add instructblip

* add otter and llama-adapter

* add owl

* add llama2-adapter and owl

* lint

* lint

* update

* lint

* lint

* add __init__.py

* update

* update

* update

---------

Co-authored-by: liuyuan <3463423099@qq.com>
2023-09-01 23:32:05 +08:00

18 lines
409 B
Python

import re
import torch
class MplugOwlMMBenchPostProcessor:
""""Post processor for MplugOwl on MMBench."""
def __init__(self) -> None:
pass
def __call__(self, output_token: torch.tensor, tokenizer) -> str:
pattern = re.compile(r'([A-Z]\.)')
res = pattern.findall(output_token)
if len(res) > 0:
output_token = res[0][:-1]
return output_token