(self, text, return_tensors=None)
| 61 | self.pad_token_id = 0 |
| 62 | |
| 63 | def encode(self, text, return_tensors=None): |
| 64 | # Simple character-level encoding |
| 65 | tokens = [ord(c) % 256 for c in text[:512]] # Limit length |
| 66 | if return_tensors == "pt": |
| 67 | return {"input_ids": torch.tensor([tokens])} |
| 68 | return tokens |
| 69 | |
| 70 | def decode(self, tokens, skip_special_tokens=True): |
| 71 | if isinstance(tokens, torch.Tensor): |
nothing calls this directly
no outgoing calls
no test coverage detected