Giter VIP home page Giter VIP logo

Comments (1)

Ai-is-light avatar Ai-is-light commented on June 13, 2024

py36t41/lib/python3.6/site-packages/torch/serialization.py", line 533, in _load
magic_number = pickle_module.load(f)
_pickle.UnpicklingError: invalid load key, '\x0a'.

while in the serialization.py
15 if sys.version_info[0] == 2:
16 import cPickle as pickle
17 else:
18 import pickle
19 import pathlib
20
21 DEFAULT_PROTOCOL = 2
22
23 LONG_SIZE = struct.Struct('=l').size
24 INT_SIZE = struct.Struct('=i').size
25 SHORT_SIZE = struct.Struct('=h').size
26
27 MAGIC_NUMBER = 0x1950a86a20f9469cfc6c
28 PROTOCOL_VERSION = 1001
29 STORAGE_KEY_SEPARATOR = ',

def save(obj, f, pickle_module=pickle, pickle_protocol=DEFAULT_PROTOCOL):
183 """Saves an object to a disk file.
184
185 See also: :ref:recommend-saving-models
186
187 Args:
188 obj: saved object
189 f: a file-like object (has to implement write and flush) or a string
190 containing a file name
191 pickle_module: module used for pickling metadata and objects
192 pickle_protocol: can be specified to override the default protocol
193
194 .. warning::
195 If you are using Python 2, torch.save does NOT support StringIO.StringIO
196 as a valid file-like object. This is because the write method should return
197 the number of bytes written; StringIO.write() does not do this.
198
199 Please use something like io.BytesIO instead.

531 print("---"*16)
532 print(f)
533 magic_number = pickle_module.load(f)
534 print("magic_number: ", magic_number)

<_io.BufferedReader name='/data/home/yonasyu/.torch/models/vgg19-dcbb9e9d.pth'>

from everybodydancenow_reproduce_pytorch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.