Create tokenizer.py
Browse files- tokenizer.py +11 -0
tokenizer.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from transformers import AutoTokenizer
|
| 3 |
+
|
| 4 |
+
class BathSalt1DaedalusPhi3Tokenizer(AutoTokenizer):
|
| 5 |
+
def __init__(self, config):
|
| 6 |
+
super().__init__(config)
|
| 7 |
+
self.config = config
|
| 8 |
+
|
| 9 |
+
def encode(self, text, return_tensors="pt"):
|
| 10 |
+
encoding = super().encode(text, return_tensors=return_tensors)
|
| 11 |
+
return encoding
|