google-research / lottery-ticket-hypothesis

A reimplementation of "The Lottery Ticket Hypothesis" (Frankle and Carbin) on MNIST.
https://arxiv.org/abs/1803.03635
Apache License 2.0
707 stars 136 forks source link

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x93 in position 0: invalid start byte #6

Open eece-23 opened 5 years ago

eece-23 commented 5 years ago

When I run python ../argfile_runner.py runners/lottery_experiment.py argfiles/lottery_experiment_argfile.py command, The following ERROR reported: Using TensorFlow backend. WARNING:tensorflow:From /Volumes/other/a2/program/lottery-ticket-hypothesis/lottery_ticket/foundations/save_restore.py:85: FastGFile.init (from tensorflow.python.platform.gfile) is deprecated and will be removed in a future version. Instructions for updating: Use tf.gfile.GFile. Traceback (most recent call last): File "runners/lottery_experiment.py", line 31, in main() File "runners/lottery_experiment.py", line 27, in main fire.Fire(lottery_experiment.train) File "/Volumes/other/a2/anaconda3/lib/python3.7/site-packages/fire/core.py", line 127, in Fire component_trace = _Fire(component, args, context, name) File "/Volumes/other/a2/anaconda3/lib/python3.7/site-packages/fire/core.py", line 366, in _Fire component, remaining_args) File "/Volumes/other/a2/anaconda3/lib/python3.7/site-packages/fire/core.py", line 542, in _CallCallable result = fn(*varargs, **kwargs) File "/Volumes/other/a2/program/lottery-ticket-hypothesis/lottery_ticket/mnist_fc/lottery_experiment.py", line 103, in train presets=save_restore.standardize(presets)) File "/Volumes/other/a2/program/lottery-ticket-hypothesis/lottery_ticket/foundations/experiment.py", line 61, in experiment initial, final = train_once(0, presets=presets) File "/Volumes/other/a2/program/lottery-ticket-hypothesis/lottery_ticket/foundations/experiment.py", line 55, in train_once dataset = make_dataset() File "/Volumes/other/a2/program/lottery-ticket-hypothesis/lottery_ticket/mnist_fc/lottery_experiment.py", line 71, in make_dataset train_order_seed=train_order_seed) File "/Volumes/other/a2/program/lottery-ticket-hypothesis/lottery_ticket/datasets/dataset_mnist.py", line 41, in init mnist = save_restore.restore_network(mnist_location) File "/Volumes/other/a2/program/lottery-ticket-hypothesis/lottery_ticket/foundations/save_restore.py", line 86, in restore_network weights_dict[name] = np.load(fp) File "/Volumes/other/a2/anaconda3/lib/python3.7/site-packages/numpy/lib/npyio.py", line 416, in load magic = fid.read(N) File "/Volumes/other/a2/anaconda3/lib/python3.7/site-packages/tensorflow/python/lib/io/file_io.py", line 132, in read pywrap_tensorflow.ReadFromStream(self._read_buf, length, status)) File "/Volumes/other/a2/anaconda3/lib/python3.7/site-packages/tensorflow/python/lib/io/file_io.py", line 100, in _prepare_value return compat.as_str_any(val) File "/Volumes/other/a2/anaconda3/lib/python3.7/site-packages/tensorflow/python/util/compat.py", line 107, in as_str_any return as_str(value) File "/Volumes/other/a2/anaconda3/lib/python3.7/site-packages/tensorflow/python/util/compat.py", line 80, in as_text return bytes_or_text.decode(encoding) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x93 in position 0: invalid start byte

FttFYQ commented 5 years ago

I have the same problem.Do you solve it?

momo1986 commented 5 years ago

Met same problems to reproduce the code.

joaolcaas commented 5 years ago

I got the same here

joaolcaas commented 5 years ago

4 alredy solve this problem.

Yerin703 commented 3 years ago

Hi, I got that problem too. I solved this problem by revising code. In the file named 'save_restore.py', in 87Line, "with tf.io.gfile.GFile(os.path.join(filename, basename)) as fp:" I fixed to "with tf.io.gfile.GFile(os.path.join(filename, basename), 'rb') as fp:"

And it worked! Thank you!!