File size: 398 Bytes
256a159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import re

import torch


class MplugOwlMMBenchPostProcessor:
    """"Post processor for MplugOwl on MMBench."""

    def __init__(self) -> None:
        pass

    def __call__(self, output_token: torch.tensor) -> str:
        pattern = re.compile(r'([A-Z]\.)')
        res = pattern.findall(output_token)
        if len(res) > 0:
            output_token = res[0][:-1]
        return output_token