Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NUP-2506: fix traversal limit #3823

Merged
merged 1 commit into from
Apr 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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