PyTorch 1.0 loading VGGFace2 weights in Python3.7Python - Sphinx adding image gives errorUnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in positionHow to replace non-ASCII charactersHow the python2 deal the string and unicode in internal?Python 3: JSON File Load with Non-ASCII CharactersHow to construct a matrix based on user input?Transform ascii to unicodeASCII non ASCII translation Python 2.7Using pefile returns unicodeDecodeErrorPython2.7 ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128)

What can cause an unfrozen indoor copper drain pipe to crack?

Why are low spin tetrahedral complexes so rare?

Removing all characters except digits from clipboard

Would encrypting a database protect against a compromised admin account?

Is there some sort of formula to determine how many bricks I would need to build a completely new structure?

Getting a error after using setState with a promise

Was Mohammed the most popular first name for boys born in Berlin in 2018?

is it permitted to swallow spit on a fast day?

How to get a ellipse shaped node in Tikz Network?

Can a surprised creature fall prone voluntarily on their turn?

My perfect evil overlord plan... or is it?

Visual representation code coverage in VSCode

How to compare d20+x with advantage to d20+y without advantage (x < y)

Is a vertical stabiliser needed for straight line flight in a glider?

Program for finding longest run of zeros from a list of 100 random integers which are either 0 or 1

Is it nonsense to say B > [A > B]?

No such column 'DeveloperName' on entity 'RecordType' after Summer '19 release on sandbox

Why does increasing the sampling rate make implementing an anti-aliasing filter easier?

Has magnetic core memory been used beyond the Moon?

Extending Kan fibrations, without using minimal fibrations

Is it a good idea to copy a trader when investing?

How is CoreiX like Corei5, i7 is related to Haswell, Ivy Bridge?

Two researchers want to work on the same extension to my paper. Who to help?

Can 'sudo apt-get remove [write]' destroy my Ubuntu?



PyTorch 1.0 loading VGGFace2 weights in Python3.7


Python - Sphinx adding image gives errorUnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in positionHow to replace non-ASCII charactersHow the python2 deal the string and unicode in internal?Python 3: JSON File Load with Non-ASCII CharactersHow to construct a matrix based on user input?Transform ascii to unicodeASCII non ASCII translation Python 2.7Using pefile returns unicodeDecodeErrorPython2.7 ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128)






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am using Python3.7 and PyTorch 1.0 to develop a face recognition system. I want to use VGGFace2 Resnet50 pretrained model as described here as a feature extractor. I have downloaded the model and weights.
I run the following codes as project readme says:



MainModel = imp.load_source('MainModel', 'resnet50_128_pytorch.py') 
model = torch.load('resnet50_128_pytorch.pth')


First line executed as expected but in the second line i got




'ascii' codec can't decode byte 0xc3 in position 1124: ordinal not in
range(128)




I searched in the Stackoverflow and Google and i saw that it may be about this model saved with Python2 and loading from Python3 creates a problem. Is there any way that i can solve this?



Thank you.










share|improve this question




























    0















    I am using Python3.7 and PyTorch 1.0 to develop a face recognition system. I want to use VGGFace2 Resnet50 pretrained model as described here as a feature extractor. I have downloaded the model and weights.
    I run the following codes as project readme says:



    MainModel = imp.load_source('MainModel', 'resnet50_128_pytorch.py') 
    model = torch.load('resnet50_128_pytorch.pth')


    First line executed as expected but in the second line i got




    'ascii' codec can't decode byte 0xc3 in position 1124: ordinal not in
    range(128)




    I searched in the Stackoverflow and Google and i saw that it may be about this model saved with Python2 and loading from Python3 creates a problem. Is there any way that i can solve this?



    Thank you.










    share|improve this question
























      0












      0








      0








      I am using Python3.7 and PyTorch 1.0 to develop a face recognition system. I want to use VGGFace2 Resnet50 pretrained model as described here as a feature extractor. I have downloaded the model and weights.
      I run the following codes as project readme says:



      MainModel = imp.load_source('MainModel', 'resnet50_128_pytorch.py') 
      model = torch.load('resnet50_128_pytorch.pth')


      First line executed as expected but in the second line i got




      'ascii' codec can't decode byte 0xc3 in position 1124: ordinal not in
      range(128)




      I searched in the Stackoverflow and Google and i saw that it may be about this model saved with Python2 and loading from Python3 creates a problem. Is there any way that i can solve this?



      Thank you.










      share|improve this question














      I am using Python3.7 and PyTorch 1.0 to develop a face recognition system. I want to use VGGFace2 Resnet50 pretrained model as described here as a feature extractor. I have downloaded the model and weights.
      I run the following codes as project readme says:



      MainModel = imp.load_source('MainModel', 'resnet50_128_pytorch.py') 
      model = torch.load('resnet50_128_pytorch.pth')


      First line executed as expected but in the second line i got




      'ascii' codec can't decode byte 0xc3 in position 1124: ordinal not in
      range(128)




      I searched in the Stackoverflow and Google and i saw that it may be about this model saved with Python2 and loading from Python3 creates a problem. Is there any way that i can solve this?



      Thank you.







      python python-3.x python-2.7 pytorch






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 23 at 9:34









      Alperen KantarcıAlperen Kantarcı

      523419




      523419






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I found a solution which currently looks like it's working. It basically changes the pickle load with latin1 encoding.



          from functools import partial
          import pickle
          pickle.load = partial(pickle.load, encoding="latin1")
          pickle.Unpickler = partial(pickle.Unpickler, encoding="latin1")
          MainModel = imp.load_source('MainModel', 'resnet50_ft_pytorch.py')
          model = torch.load('resnet50_ft_pytorch.pth', map_location=lambda storage, loc: storage, pickle_module=pickle)





          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55312396%2fpytorch-1-0-loading-vggface2-weights-in-python3-7%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I found a solution which currently looks like it's working. It basically changes the pickle load with latin1 encoding.



            from functools import partial
            import pickle
            pickle.load = partial(pickle.load, encoding="latin1")
            pickle.Unpickler = partial(pickle.Unpickler, encoding="latin1")
            MainModel = imp.load_source('MainModel', 'resnet50_ft_pytorch.py')
            model = torch.load('resnet50_ft_pytorch.pth', map_location=lambda storage, loc: storage, pickle_module=pickle)





            share|improve this answer



























              0














              I found a solution which currently looks like it's working. It basically changes the pickle load with latin1 encoding.



              from functools import partial
              import pickle
              pickle.load = partial(pickle.load, encoding="latin1")
              pickle.Unpickler = partial(pickle.Unpickler, encoding="latin1")
              MainModel = imp.load_source('MainModel', 'resnet50_ft_pytorch.py')
              model = torch.load('resnet50_ft_pytorch.pth', map_location=lambda storage, loc: storage, pickle_module=pickle)





              share|improve this answer

























                0












                0








                0







                I found a solution which currently looks like it's working. It basically changes the pickle load with latin1 encoding.



                from functools import partial
                import pickle
                pickle.load = partial(pickle.load, encoding="latin1")
                pickle.Unpickler = partial(pickle.Unpickler, encoding="latin1")
                MainModel = imp.load_source('MainModel', 'resnet50_ft_pytorch.py')
                model = torch.load('resnet50_ft_pytorch.pth', map_location=lambda storage, loc: storage, pickle_module=pickle)





                share|improve this answer













                I found a solution which currently looks like it's working. It basically changes the pickle load with latin1 encoding.



                from functools import partial
                import pickle
                pickle.load = partial(pickle.load, encoding="latin1")
                pickle.Unpickler = partial(pickle.Unpickler, encoding="latin1")
                MainModel = imp.load_source('MainModel', 'resnet50_ft_pytorch.py')
                model = torch.load('resnet50_ft_pytorch.pth', map_location=lambda storage, loc: storage, pickle_module=pickle)






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 23 at 11:35









                Alperen KantarcıAlperen Kantarcı

                523419




                523419





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55312396%2fpytorch-1-0-loading-vggface2-weights-in-python3-7%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

                    밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

                    1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴