Skip to content

Commit

Permalink
NUP-2506: fix traversal limit (#3823)
Browse files Browse the repository at this point in the history
  • Loading branch information
lscheinkman authored and rhyolight committed Apr 4, 2018
1 parent a9b9f9f commit a7ab556
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/nupic/frameworks/opf/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import nupic.frameworks.opf.opf_utils as opf_utils
from nupic.serializable import Serializable

# Capnp reader traveral limit (see capnp::ReaderOptions)
_TRAVERSAL_LIMIT_IN_WORDS = 1 << 63

class Model(Serializable):
""" This is the base class that all OPF Model implementations should
Expand Down Expand Up @@ -264,11 +266,12 @@ def writeToCheckpoint(self, checkpointDir):

@classmethod
def readFromCheckpoint(cls, checkpointDir):
"""Deerializes model from checkpointDir using capnproto"""
"""Deserializes model from checkpointDir using capnproto"""
checkpointPath = cls._getModelCheckpointFilePath(checkpointDir)

with open(checkpointPath, 'r') as f:
proto = cls.getSchema().read(f)
proto = cls.getSchema().read(f,
traversal_limit_in_words=_TRAVERSAL_LIMIT_IN_WORDS)

model = cls.read(proto)
return model
Expand Down

0 comments on commit a7ab556

Please sign in to comment.