Skip to content

Commit

Permalink
type annotation for BPE.decode fixed (VKCOM#83)
Browse files Browse the repository at this point in the history
Co-authored-by: d.gavrilov <[email protected]>
  • Loading branch information
kefirski and d.gavrilov authored Jan 28, 2021
1 parent 9c758c1 commit f4bc5f8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions youtokentome/youtokentome.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import _youtokentome_cython
from enum import Enum
from typing import List, Union, Optional, Collection

import _youtokentome_cython


class OutputType(Enum):
ID = 1
Expand Down Expand Up @@ -82,8 +81,10 @@ def id_to_subword(self, id: int) -> str:
return self.bpe_cython.id_to_subword(id)

def decode(
self, ids: List[int], ignore_ids: Optional[Collection[int]] = None
) -> str:
self,
ids: Union[List[int], List[List[int]]],
ignore_ids: Optional[Collection[int]] = None,
) -> List[str]:
return self.bpe_cython.decode(ids, ignore_ids)

def __getstate__(self):
Expand Down

0 comments on commit f4bc5f8

Please sign in to comment.