Saving Spatial Pooler

Hello!

I want to migrate from Python2 to Python3. That’s why I use htm.core( community fork). And I don’t understand about serialization in htm.core. I want to save Spatial Pooler, but I get error: AttributeError: ‘htm.bindings.algorithms.SpaialPooler’ object has no attribute ‘save’

Breznak, Dkeeney, Dmac maybe you can explain to me?

1 Like

I’m facing a similar problem.

[bindings/py/tests/algorithms/spatial_pooler_test.py]

def testNupicSpatialPoolerPickling(self):
sp = SP()
pickledSp = pickle.dumps(sp)
sp2 = pickle.loads(pickledSp)

Following the example above, I ran the following tests and got the following results:

Python 3.7.3 (default, Mar 27 2019, 22:11:17)
[GCC 7.3.0] on linux

import pickle
from htm.bindings.algorithms import SpatialPooler
sp = SpatialPooler()
print(str(sp))

Spatial Pooler Connections:
Inputs (1024) ~> Outputs (4096) via Segments (4096)
Segments on Cell Min/Mean/Max 1 / 1 / 1
Potential Synapses on Segment Min/Mean/Max 512 / 512 / 512
Connected Synapses on Segment Min/Mean/Max 218 / 256.154 / 302
Synapses Dead (0%) Saturated (0%)

with open(‘saved_model/sp.pickle’, ‘wb’) as f:
pickle.dump(sp, f)

with open(‘saved_model/sp.pickle’, ‘rb’) as f:
saved_sp = pickle.load(f)

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

1 Like

Maybe go to the HTM.core issue page and create a new issue there? So the devs can see what’s happening.

1 Like

Both the save(stream) and the pickle should have worked from python3.
Please post an issue for us as @marty1885 suggested so we can track it.

I will start looking at it. It might be something wrong with our bindings.

Thanks. I will repeat this question on HTM.core issue page

I created new issue page

@Sergey Thanks to uploading!

No problem :slight_smile: