Loading state_dict on Raspberry Pi

I’m trying to load a State Dict that I saved on a Windows PC with a Raspberry Pi. I’m getting an error message that delivers almost no results on google:
ValueError: whence value 1460 unsupported (full traceback below)

Here some info about the two systems:
-Windows machine:
-Windows 7, 64bit
-torch._ version _ prints “0.4.1”
-only training on cpu
-num_workers=0 when creating the DataLoader Class.

-Raspberry Pi:
-Raspberry Pi 3 Model b+
-torch._ version _ prints “1.2.0a0+7c40576”
-The file containing the network structure is the same
-I’m loading the state_dict with “self.net.load_state_dict(torch.load(path))”
-When I’m not trying to load the state_dict, everything works out fine (basicly only the forward pass of the model), but I obviously get the wrong values.

If needed, I will try to reproduce the issue with the minimal amount of code, but I thought I give it a try here first. Maybe I can solve the issue with additional parameters (like telling the model that it now runs on another processor)?

Thanks in advance an best regards,

Full traceback:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python3.5/tkinter/__init__.py", line 1562, in __call__
    return self.func(*args)
  File "/home/pi/Desktop/Daten_Aufnehmen/Gui.py", line 547, in clickBtnOk
  File "/home/pi/Desktop/Daten_Aufnehmen/Neural_network.py", line 161, in createNets
    self.cam_nets.append(NeuralNetwork(file,netDef, cam_sen="camera", n_settings=len(self.settings)))
  File "/home/pi/Desktop/Daten_Aufnehmen/Neural_network.py", line 177, in __init__
  File "/usr/local/lib/python3.5/dist-packages/torch/serialization.py", line 386, in load
    return _load(f, map_location, pickle_module, **pickle_load_args)
  File "/usr/local/lib/python3.5/dist-packages/torch/serialization.py", line 580, in _load
    deserialized_objects[key]._set_from_file(f, offset, f_should_read_directly)
ValueError: whence value 1460 unsupported

Here the update with minimum code:
This works on my Windows PC but not on the Raspberry Pi.

from Networks import ImageNN_1
import torch

print ("Worked")

I think the first problem is the version mismatch between your two machines (0.4.1 and 1.2.0a). Could you try installing 0.4.1 on the raspberry and checking again?

1 Like

Thank you, downgrading did the Trick.

1 Like