# Loading state\_dict on Raspberry Pi

**URL:** <https://discuss.pytorch.org/t/loading-state-dict-on-raspberry-pi/48247>\
**Category:** Uncategorized\
**Created:** [June 18, 2019, 10:07am UTC](https://discuss.pytorch.org/t/loading-state-dict-on-raspberry-pi/48247 "2019-06-18T10:07:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leo-Lautsprecher](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/l/c77e96/32.png) [@Leo-Lautsprecher](https://discuss.pytorch.org/u/Leo-Lautsprecher)\
**Post date:** [June 18, 2019, 10:07am UTC](https://discuss.pytorch.org/t/loading-state-dict-on-raspberry-pi/48247/1 "2019-06-18T10:07:19Z")

</div>

Hello,  
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,  
Leo

Full traceback:

```auto
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
    self.network.createNets()
  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__
    self.net.load_state_dict(torch.load(path))
  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

```

---

<div class="post-metadata">

**Author:** ![Leo-Lautsprecher](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/l/c77e96/32.png) [@Leo-Lautsprecher](https://discuss.pytorch.org/u/Leo-Lautsprecher)\
**Post date:** [June 19, 2019, 6:45am UTC](https://discuss.pytorch.org/t/loading-state-dict-on-raspberry-pi/48247/2 "2019-06-19T06:45:29Z")

</div>

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

```auto
from Networks import ImageNN_1
import torch

path="State_Dict_Camera1_ImageNN_1.pt"
net=ImageNN_1(3)
state_dict=torch.load(path)
print ("Worked")

```

---

<div class="post-metadata">

**Author:** ![alex.veuthey](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/alex.veuthey/32/12176_2.png) [@alex.veuthey](https://discuss.pytorch.org/u/alex.veuthey)\
**Post date:** [June 19, 2019, 8:04am UTC](https://discuss.pytorch.org/t/loading-state-dict-on-raspberry-pi/48247/3 "2019-06-19T08:04:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Leo-Lautsprecher](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/l/c77e96/32.png) [@Leo-Lautsprecher](https://discuss.pytorch.org/u/Leo-Lautsprecher)\
**Post date:** [June 26, 2019, 5:39am UTC](https://discuss.pytorch.org/t/loading-state-dict-on-raspberry-pi/48247/4 "2019-06-26T05:39:02Z")

</div>

Thank you, downgrading did the Trick.
