Giter Site home page Giter Site logo

Comments (3)

exition avatar exition commented on May 27, 2024

me too , wrong encoded pth file

from pytorch-deep-image-matting.

xiaoqiangsheng2016 avatar xiaoqiangsheng2016 commented on May 27, 2024

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xda in position 5: invalid continuation byte

me too

from pytorch-deep-image-matting.

huochaitiantang avatar huochaitiantang commented on May 27, 2024

Hey guys, the bug is fixed now, and the patch is upstreamed!
Please see:

'''
Load model exported by python2 with python3 will cause error:
ascii' codec can't decode byte 0xda in position 5
The following codes will fix the bug
'''
def my_torch_load(fname):
try:
ckpt = torch.load(fname)
return ckpt
except Exception as e:
print("Load Error:{}\nTry Load Again...".format(e))
class C:
pass
def c_load(ss):
return pickle.load(ss, encoding='latin1')
def c_unpickler(ss):
return pickle.Unpickler(ss, encoding='latin1')
c = C
c.load = c_load
c.Unpickler = c_unpickler
ckpt = torch.load(args.resume, pickle_module=c)
return ckpt

from pytorch-deep-image-matting.

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.