mirror of
https://github.com/open-compass/opencompass.git
synced 2025-05-30 16:03:24 +08:00
18 lines
409 B
Python
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
|