I am trying to save my model parameters, together with some extra information.
For this, I used the principle explained in this post.
Here are the methods I defined on my models, to save the parameters:
(self.seen is an integer)
    def load_pickle_weights(self, weights_file):
        state = torch.load(weights_file)
        self.seen = state['seen']
        self.load_state_dict(state['weights'])

    def save_pickle_weights(self, weights_file):
        state = {
            'seen': self.seen,
            'weights': self.state_dict(),
        }
        torch.save(state, weights_file)

I am however, getting the following error:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/app/models/objectdet.py", line 80, in __init__
    self.load_pickle_weights(weights_pickle)
  File "/app/network.py", line 85, in load_pickle_weights
    state = torch.load(weights_file)
  File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 261, in load
    return _load(f, map_location, pickle_module)
  File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 394, in _load
    return legacy_load(f)
  File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 329, in legacy_load
    with closing(tarfile.open(fileobj=f, mode='r:', format=tarfile.PAX_FORMAT)) as tar, \
  File "/opt/conda/lib/python3.6/tarfile.py", line 1586, in open
    return func(name, filemode, fileobj, **kwargs)
  File "/opt/conda/lib/python3.6/tarfile.py", line 1616, in taropen
    return cls(name, mode, fileobj, **kwargs)
  File "/opt/conda/lib/python3.6/tarfile.py", line 1471, in __init__
    self.offset = self.fileobj.tell()
AttributeError: 'bool' object has no attribute 'tell'

If I just save the state_dict, as explained here 16 I get no error…