Closed wanji closed 9 years ago
Thx @wanji , I will give it a look asap and merge it. Sounds good! :)
hi @wanji thanks again for the cool contribution.
python run_tests.py fails saying:
Traceback (most recent call last): File "/Users/ole/Development/misc/NearPy/nearpy/tests/storage_tests.py", line 66, in test_redis_storage X = self.redis_storage.get_bucket('testHash', bucket_key) File "/Users/ole/Development/misc/NearPy/nearpy/storage/storage_redis.py", line 100, in get_bucket val_dict = cPickle.loads(want_string(item_str)) File "/Users/ole/Development/misc/NearPy/nearpy/utils/utils.py", line 66, in want_string rv = arg.decode(encoding) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 0: invalid start byte
could you fix that?
i just merged develop into master, so it would be best if you work on the new master code base.
@pixelogik Sure, will update the master code and check again :)
@pixelogik
This error is due to decoding a pickled string as utf-8
. After remove want_string
from val_dict = cPickle.loads(want_string(item_str))
, the code can pass the tests. Is this acceptable?
Alright thx, I removed that call. Tests run successful.
Thanks :)
--
Best regards,
Wan Ji
Date: Thu, 6 Nov 2014 03:45:37 -0800 From: notifications@github.com To: NearPy@noreply.github.com CC: wanji@live.com Subject: Re: [NearPy] more compact serialization; fix dtype issue (#29)
Alright thx, I removed that call. Tests run successful.
¡ª Reply to this email directly or view it on GitHub.
4096-D
single precision float vector requires83KB
memory, while the useful data only requires16KB
memory. I have replacedtostring()
withtolist()
, and replacedjson.dumps
withcPickle.dumps
. The amount of required memory reduced to about16KB
.numpy.array
from Redis,float64
is used asdtype
, which causes errors for other data type. I recored thedtype
field ofnumpy.array
invar_dict
, and used it for rebuildingnumpy.array