qnn-inference-examples icon indicating copy to clipboard operation
qnn-inference-examples copied to clipboard

UnicodeDecodeError in the file 0-basics.ipynb

Open medric49 opened this issue 6 years ago • 6 comments

When I try to execute the 3rd python section in the file 0-basics.ipynb, I get an error: UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 0: ordinal not in range(128)

It's due to this code qnn = pickle.load(open("mnist-w1a1.pickle", "rb")) It seems that there is an indecodable code in the file mnist-w1a1.pickle, or something like that.

medric49 avatar Mar 13 '20 14:03 medric49

Finally, I fixed the problem by setting the value "bytes" to the parameter encoding in the function pickle.load(), like that : qnn = pickle.load(open("mnist-w1a1.pickle", "rb"), encoding="bytes")

medric49 avatar Mar 17 '20 23:03 medric49

Good to hear that it was a relatively straightforward fix. Could you make a pull request that incorporates this fix?

maltanar avatar Mar 18 '20 09:03 maltanar

Finally, I fixed the problem by setting the value "bytes" to the parameter encoding in the function pickle.load(), like that : qnn = pickle.load(open("mnist-w1a1.pickle", "rb"), encoding="bytes")

This proposal worked for me in the beginning, but the 5th module was not working due to "non-existing" 'thresholds' attributes. I finally solved the problem by using Python 2 kernel instead of Python 3 (I am using the 2.7.17 release). It seems to be a compatibility problem, but it can easily be solved. I hope this works for you @medric49 :)

jalezeta avatar Mar 30 '20 12:03 jalezeta

Finally, I fixed the problem by setting the value "bytes" to the parameter encoding in the function pickle.load(), like that : qnn = pickle.load(open("mnist-w1a1.pickle", "rb"), encoding="bytes")

This proposal worked for me in the beginning, but the 5th module was not working due to "non-existing" 'thresholds' attributes. I finally solved the problem by using Python 2 kernel instead of Python 3 (I am using the 2.7.17 release). It seems to be a compatibility problem, but it can easily be solved. I hope this works for you @medric49 :)

Effectively, the last section doesn't work for me. Whether it's Python 2 or 3, it doesn't work. The attribute "thresholds" seems to be nonexistent. I am trying to fix it.

medric49 avatar Apr 10 '20 19:04 medric49

The problem is that, when the data of the neural network are loaded, this one doesn't consider the attributes created in its constructor, in fact these elements have not been saved. So, the qnn object just considers the skeleton of its class.

medric49 avatar Apr 10 '20 20:04 medric49

Effectively, the last section doesn't work for me. Whether it's Python 2 or 3, it doesn't work. The attribute "thresholds" seems to be nonexistent. I am trying to fix it.

So, any fix for this?

shobhitt10 avatar Dec 12 '21 19:12 shobhitt10