Coder Social home page Coder Social logo

Comments (8)

HappyCoderMan avatar HappyCoderMan commented on August 12, 2024 11

Get the Python3 compatible version of skipthoughts.py here:
https://github.com/ryankiros/skip-thoughts/pull/53/files

I'm also on Anacnoda x64, and my path_to_skipthoughts looks like this:
path_to_skipthoughts = 'C:\neuralstoryteller\skip-thoughts-master\'
I have the models in a subfolder of that path named "models", and this works.

You can also just change iteritems() to items() in most of these cases to fix that error.

from neural-storyteller.

HappyCoderMan avatar HappyCoderMan commented on August 12, 2024 1

Please check your bi_skip.npz file. It may be corrupt or missing if the error says it's not a valid zip file.
My code makes that file name like this: path_to_bmodel = path_to_models + 'bi_skip.npz'
Mine has this size: 289,340,074 bytes
Mine is in this folder: ./models/
I have a bi_skip.npz.pkl file at the same path that is 689 bytes.

The config.py sets the relative path like this:

Skip-thoughts

paths['skmodels'] = './models/'
paths['sktables'] = './models/'

from neural-storyteller.

SundareshPrasanna avatar SundareshPrasanna commented on August 12, 2024

Hi @ErikOmberg thanks for the Python3 compatible version.. when i try to use the new skip-thought code (py3 compatible one), i get an error message as below:

C:\Users\Dell\Documents\Neural_storyteller\neural_storyteller\romance.npz
Loading skip-thoughts...
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Dell\Documents\Neural_storyteller\neural-storyteller-master\generate.py", line 86, in load_all
config.paths['sktables'])
TypeError: load_model() takes 0 positional arguments but 2 were given

Can u help me with this? I see that we are passing 2 arguments config.paths['skmodels'], config.paths['sktables'] in the original generate.py.. while in the new skipthought i see load_model does not take any arguments.. so i tried to change it to just
stv = skipthoughts.load_model()
and got the error:

Loading model parameters...
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Dell\Documents\Neural_storyteller\neural-storyteller-master\generate.py", line 85, in load_all
stv = skipthoughts.load_model()
File "C:\Users\Dell\Documents\Neural_storyteller\neural-storyteller-master\skipthoughts.py", line 55, in load_model
bparams = load_params(path_to_bmodel, bparams)
File "C:\Users\Dell\Documents\Neural_storyteller\neural-storyteller-master\skipthoughts.py", line 259, in load_params
pp = numpy.load(path)
File "C:\Users\Dell\Anaconda3\envs\tensorflow-gpu\lib\site-packages\numpy\lib\npyio.py", line 412, in load
pickle_kwargs=pickle_kwargs)
File "C:\Users\Dell\Anaconda3\envs\tensorflow-gpu\lib\site-packages\numpy\lib\npyio.py", line 171, in init
_zip = zipfile_factory(fid)
File "C:\Users\Dell\Anaconda3\envs\tensorflow-gpu\lib\site-packages\numpy\lib\npyio.py", line 101, in zipfile_factory
return zipfile.ZipFile(file, *args, **kwargs)
File "C:\Users\Dell\Anaconda3\envs\tensorflow-gpu\lib\zipfile.py", line 1026, in init
self._RealGetContents()
File "C:\Users\Dell\Anaconda3\envs\tensorflow-gpu\lib\zipfile.py", line 1093, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file

from neural-storyteller.

HappyCoderMan avatar HappyCoderMan commented on August 12, 2024

You're right - I see that link I posted only had a loadmodel function with no arguments. I didn't use that code directly. I started with the master code, and made some code changes (based on that link) to get my py3 working.

The necessary changes aren't too bad. It's mostly a few "items" change to "iteritems", parenthesis around print statements, etc...

from neural-storyteller.

SundareshPrasanna avatar SundareshPrasanna commented on August 12, 2024

I agree.. but i am getting an error when i do so :( could u help me with the error below

Loading skip-thoughts...
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Dell\Documents\Neural_storyteller\neural-storyteller-master\generate.py", line 86, in load_all
config.paths['sktables'])
File "C:\Users\Dell\Documents\Neural_storyteller\neural-storyteller-master\skipthoughts.py", line 39, in load_model
bparams = load_params(path_to_bmodel, bparams)
File "C:\Users\Dell\Documents\Neural_storyteller\neural-storyteller-master\skipthoughts.py", line 174, in load_params
pp = numpy.load(path)
File "C:\Users\Dell\Anaconda3\envs\tensorflow-gpu\lib\site-packages\numpy\lib\npyio.py", line 412, in load
pickle_kwargs=pickle_kwargs)
File "C:\Users\Dell\Anaconda3\envs\tensorflow-gpu\lib\site-packages\numpy\lib\npyio.py", line 171, in init
_zip = zipfile_factory(fid)
File "C:\Users\Dell\Anaconda3\envs\tensorflow-gpu\lib\site-packages\numpy\lib\npyio.py", line 101, in zipfile_factory
return zipfile.ZipFile(file, *args, **kwargs)
File "C:\Users\Dell\Anaconda3\envs\tensorflow-gpu\lib\zipfile.py", line 1026, in init
self._RealGetContents()
File "C:\Users\Dell\Anaconda3\envs\tensorflow-gpu\lib\zipfile.py", line 1093, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file

from neural-storyteller.

SundareshPrasanna avatar SundareshPrasanna commented on August 12, 2024

Thanks a lot @ErikOmberg .. i didn't notice that my file was corrupted.. i have one question tho wrt resize in generate.py

line 154: im = skimage.transform.resize(im, (256, w*256/h), preserve_range=True)
here, there is a possibility that the number won't end up as integer.. so should we add int() to round it up?

from neural-storyteller.

HappyCoderMan avatar HappyCoderMan commented on August 12, 2024

Yes, I made that change too:
int(w*256/h)

from neural-storyteller.

SundareshPrasanna avatar SundareshPrasanna commented on August 12, 2024

Thanks @ErikOmberg .. I've raised a new issue #37 i was wondering if u could help me with that or have u faced similar issues while running your codes.

from neural-storyteller.

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.