Closed jeffhgs closed 5 years ago
Closing:
Under python 2.7 the new unpickling code crashes like so:
File "/Users/jehenrik/srchome/3pmod/deep_learning_and_the_game_of_go/code/dlgo/nn/load_mnist.py", line 27, in load_data
data = pickle._Unpickler(f)
AttributeError: 'module' object has no attribute '_Unpickler'
@jeffhgs why not do this:
def load_data():
with gzip.open('mnist.pkl.gz', 'rb') as f:
if hasattr(pickle, "_Unpickler"): # Python 3
data = pickle._Unpickler(f)
data.encoding = 'latin1' # set encoding
train_data, validation_data, test_data = data.load()
else: # Python 2
train_data, validation_data, test_data = pickle.load(f)
Incorporates pickling arguments suggested by maxpumperla https://github.com/maxpumperla/deep_learning_and_the_game_of_go/issues/12
Before submitting a pull request, note that
master
and the respective chapter branches need to stay in sync with the print version of the book.master
.improvements
branch.Should your current PR mix these types of changes, please consider to split it accordingly. Thank you!