Skip to content

Commit

Permalink
Fix #32: Cannot save XLNet model
Browse files Browse the repository at this point in the history
  • Loading branch information
honnibal committed Aug 12, 2019
1 parent 2675ef2 commit 77a2f2d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Empty file removed examples/tasks/__init__.py
Empty file.
7 changes: 4 additions & 3 deletions spacy_pytorch_transformers/_tokenizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,10 @@ def blank(cls):
return self

def prepare_for_serialization(self):
vocab_path = Path(self.vocab_file)
with vocab_path.open("rb") as f:
self.vocab_bytes = f.read()
if hasattr(self, "vocab_file"):
vocab_path = Path(self.vocab_file)
with vocab_path.open("rb") as f:
self.vocab_bytes = f.read()

def finish_deserializing(self):
self.sp_model = sentencepiece.SentencePieceProcessor()
Expand Down

0 comments on commit 77a2f2d

Please sign in to comment.