(self, text:str, max_length:int)
| 44 | self.spp = SentencePieceProcessor(str(spiece_path)) |
| 45 | |
| 46 | def encode(self, text:str, max_length:int) -> List[int]: |
| 47 | encoded = self.spp.Encode(text) |
| 48 | if len(encoded) > max_length - 1: encoded = encoded[:max_length - 1] |
| 49 | return encoded + [1] + [0]*(max_length - len(encoded) - 1) |
| 50 | |
| 51 | class T5LayerNorm: |
| 52 | def __init__(self, hidden_size:int, eps:float=1e-6): |
no outgoing calls
no test coverage detected