Spaces:
Sleeping
Sleeping
Update model.py
Browse files
model.py
CHANGED
|
@@ -223,8 +223,14 @@ CHECKPOINT_PATH = hf_hub_download(
|
|
| 223 |
|
| 224 |
VOCAB_PATH = os.path.join(script_dir, "vocab.pkl")
|
| 225 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
with open(VOCAB_PATH, "rb") as f:
|
| 227 |
-
vocab =
|
| 228 |
|
| 229 |
vocab_size = len(vocab)
|
| 230 |
|
|
|
|
| 223 |
|
| 224 |
VOCAB_PATH = os.path.join(script_dir, "vocab.pkl")
|
| 225 |
|
| 226 |
+
class CustomUnpickler(pickle.Unpickler):
|
| 227 |
+
def find_class(self, module, name):
|
| 228 |
+
if name == "Vocabulary":
|
| 229 |
+
return Vocabulary
|
| 230 |
+
return super().find_class(module, name)
|
| 231 |
+
|
| 232 |
with open(VOCAB_PATH, "rb") as f:
|
| 233 |
+
vocab = CustomUnpickler(f).load()
|
| 234 |
|
| 235 |
vocab_size = len(vocab)
|
| 236 |
|