Skip to content

Instantly share code, notes, and snippets.

@Arseny-N
Created July 19, 2021 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arseny-N/e89779d0e19ce46666f4b95ebcb492c0 to your computer and use it in GitHub Desktop.
Save Arseny-N/e89779d0e19ce46666f4b95ebcb492c0 to your computer and use it in GitHub Desktop.
ValueError Traceback (most recent call last)
~/.anaconda3/envs/chm/lib/python3.7/tarfile.py in nti(s)
186 s = nts(s, "ascii", "strict")
--> 187 n = int(s.strip() or "0", 8)
188 except ValueError:
ValueError: invalid literal for int() with base 8: '_tensor_'
During handling of the above exception, another exception occurred:
InvalidHeaderError Traceback (most recent call last)
~/.anaconda3/envs/chm/lib/python3.7/tarfile.py in next(self)
2288 try:
-> 2289 tarinfo = self.tarinfo.fromtarfile(self)
2290 except EOFHeaderError as e:
~/.anaconda3/envs/chm/lib/python3.7/tarfile.py in fromtarfile(cls, tarfile)
1094 buf = tarfile.fileobj.read(BLOCKSIZE)
-> 1095 obj = cls.frombuf(buf, tarfile.encoding, tarfile.errors)
1096 obj.offset = tarfile.fileobj.tell() - BLOCKSIZE
~/.anaconda3/envs/chm/lib/python3.7/tarfile.py in frombuf(cls, buf, encoding, errors)
1036
-> 1037 chksum = nti(buf[148:156])
1038 if chksum not in calc_chksums(buf):
~/.anaconda3/envs/chm/lib/python3.7/tarfile.py in nti(s)
188 except ValueError:
--> 189 raise InvalidHeaderError("invalid header")
190 return n
InvalidHeaderError: invalid header
During handling of the above exception, another exception occurred:
ReadError Traceback (most recent call last)
~/.anaconda3/envs/chm/lib/python3.7/site-packages/torch/serialization.py in _load(f, map_location, pickle_module, **pickle_load_args)
594 try:
--> 595 return legacy_load(f)
596 except tarfile.TarError:
~/.anaconda3/envs/chm/lib/python3.7/site-packages/torch/serialization.py in legacy_load(f)
505
--> 506 with closing(tarfile.open(fileobj=f, mode='r:', format=tarfile.PAX_FORMAT)) as tar, \
507 mkdtemp() as tmpdir:
~/.anaconda3/envs/chm/lib/python3.7/tarfile.py in open(cls, name, mode, fileobj, bufsize, **kwargs)
1592 raise CompressionError("unknown compression type %r" % comptype)
-> 1593 return func(name, filemode, fileobj, **kwargs)
1594
~/.anaconda3/envs/chm/lib/python3.7/tarfile.py in taropen(cls, name, mode, fileobj, **kwargs)
1622 raise ValueError("mode must be 'r', 'a', 'w' or 'x'")
-> 1623 return cls(name, mode, fileobj, **kwargs)
1624
~/.anaconda3/envs/chm/lib/python3.7/tarfile.py in __init__(self, name, mode, fileobj, format, tarinfo, dereference, ignore_zeros, encoding, errors, pax_headers, debug, errorlevel, copybufsize)
1485 self.firstmember = None
-> 1486 self.firstmember = self.next()
1487
~/.anaconda3/envs/chm/lib/python3.7/tarfile.py in next(self)
2300 elif self.offset == 0:
-> 2301 raise ReadError(str(e))
2302 except EmptyHeaderError:
ReadError: invalid header
During handling of the above exception, another exception occurred:
RuntimeError Traceback (most recent call last)
<ipython-input-122-12b25078c84f> in <module>
3 # Model initialization
4 model = chmnet.CHMNet(args.ktype).cuda()
----> 5 model.load_state_dict(torch.load(args.load))
6 Evaluator.initialize(args.alpha)
7 Geometry.initialize(img_size=args.img_size)
~/.anaconda3/envs/chm/lib/python3.7/site-packages/torch/serialization.py in load(f, map_location, pickle_module, **pickle_load_args)
424 if sys.version_info >= (3, 0) and 'encoding' not in pickle_load_args.keys():
425 pickle_load_args['encoding'] = 'utf-8'
--> 426 return _load(f, map_location, pickle_module, **pickle_load_args)
427 finally:
428 if new_fd:
~/.anaconda3/envs/chm/lib/python3.7/site-packages/torch/serialization.py in _load(f, map_location, pickle_module, **pickle_load_args)
597 if _is_zipfile(f):
598 # .zip is used for torch.jit.save and will throw an un-pickling error here
--> 599 raise RuntimeError("{} is a zip archive (did you mean to use torch.jit.load()?)".format(f.name))
600 # if not a tarfile, reset file offset and proceed
601 f.seek(0)
RuntimeError: pas_psi.pt is a zip archive (did you mean to use torch.jit.load()?)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment