Coder Social home page Coder Social logo

robinsloan / sentence-space Goto Github PK

View Code? Open in Web Editor NEW
196.0 196.0 15.0 986.39 MB

Generating gradients, exploring neighborhoods.

Home Page: https://www.robinsloan.com/notes/voyages-in-sentence-space/

License: Other

Python 98.12% Shell 0.41% Ruby 1.47%

sentence-space's People

Contributors

richardassar avatar robinsloan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sentence-space's Issues

Dockerize

hey @robinsloan ! I saw your post and played around with the web application, and this is so great! I'm working on Dockerizing this for you (since the dependency base is a little funky!) and I was hoping you might be able to help by providing me as much version info for the various modules that you can. Usually if you do a pip freeze, e.g.,

pip freeze

with the active environment where the application works, it will spit out a nice list. I had originally thought I'd port everything to python 3, but looking at the changes in theano I'm going to first start with the version that you have. The second bit is that there seems to be be hard coded paths to model files in some of the json objects:

grep -R /home/robin
session/sp15_trial/hyper_params.json:{"vocab": "vocab.pkl", "max_len": 128, "lstm_size": 1000, "p": 0.0, "alpha": 0.3, "sp_model": "/home/robin/dev/water-margin/sp/sf256.model", "z": 128, "dataset": "scifi-plus-gutenberg.txt"}

If you might be able to do a grep and then (even just tell me here) I'll be able to fix everything up. I'm creating a base docker image (Dockerfile) and then a compose file to add the nginx webserver, to (likely) keep running with gunicorn.

Dead links

Looks like the links in the sidebar and README now lead to 404s

TypeError: CudaNdarrayType only supports dtype float32 for now. Tried using dtype float64 for variable None

No matter what I do it always gives some kind of error. Here's what I have so far:

https://colab.research.google.com/drive/16JGbld8Q1KwX20r5vn2yaDscyF2hJDpc?usp=sharing

 * Serving Flask app "textproject_server.py"
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
ImportError: No module named _multiarray_umath
ImportError: No module named _multiarray_umath
ImportError: No module named _multiarray_umath
ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: numpy.core.multiarray failed to import
ImportError: No module named _multiarray_umath
It begins
Loaded vocab with 99 chars:
{0: '<pad>', 1: '<unk>', 2: '<end>', 3: ' ', 4: '!', 5: '"', 6: '#', 7: '$', 8: '%', 9: '&', 10: "'", 11: '(', 12: ')', 13: '*', 14: '+', 15: ',', 16: '-', 17: '.', 18: '/', 19: '0', 20: '1', 21: '2', 22: '3', 23: '4', 24: '5', 25: '6', 26: '7', 27: '8', 28: '9', 29: ':', 30: ';', 31: '<', 32: '=', 33: '>', 34: '?', 35: '@', 36: 'A', 37: 'B', 38: 'C', 39: 'D', 40: 'E', 41: 'F', 42: 'G', 43: 'H', 44: 'I', 45: 'J', 46: 'K', 47: 'L', 48: 'M', 49: 'N', 50: 'O', 51: 'P', 52: 'Q', 53: 'R', 54: 'S', 55: 'T', 56: 'U', 57: 'V', 58: 'W', 59: 'X', 60: 'Y', 61: 'Z', 62: '[', 63: '\\', 64: ']', 65: '^', 66: '_', 67: '`', 68: 'a', 69: 'b', 70: 'c', 71: 'd', 72: 'e', 73: 'f', 74: 'g', 75: 'h', 76: 'i', 77: 'j', 78: 'k', 79: 'l', 80: 'm', 81: 'n', 82: 'o', 83: 'p', 84: 'q', 85: 'r', 86: 's', 87: 't', 88: 'u', 89: 'v', 90: 'w', 91: 'x', 92: 'y', 93: 'z', 94: '{', 95: '|', 96: '}', 97: '~', 98: '\x7f'}
Not using sentencepiece
Loading session sample_no_sp_2
Trained using dataset sample_no_sp_2
z: 128, max_len: 128, p: 0.0, lstm_size: 1000, alpha: 0.3
loading session/sample_no_sp_2/model.flt
loaded conv1_W
loaded conv1_b
loaded bn1_beta
loaded bn1_gamma
loaded conv2_W
loaded conv2_b
loaded bn2_beta
loaded bn2_gamma
loaded conv3_W
loaded conv3_b
loaded bn3_beta
loaded bn3_gamma
loaded conv4_W
loaded conv4_b
loaded bn4_beta
loaded bn4_gamma
loaded conv5_W
loaded conv5_b
loaded bn5_beta
loaded bn5_gamma
loaded fc_encode_W
loaded fc_encode_b
loaded fc_decode_W
loaded fc_decode_b
loaded deconv5_W
loaded deconv5_b
loaded deconv_bn5_beta
loaded deconv_bn5_gamma
loaded deconv4_W
loaded deconv4_b
loaded deconv_bn4_beta
loaded deconv_bn4_gamma
loaded deconv3_W
loaded deconv3_b
loaded deconv_bn3_beta
loaded deconv_bn3_gamma
loaded deconv2_W
loaded deconv2_b
loaded deconv_bn2_beta
loaded deconv_bn2_gamma
loaded deconv1_W
loaded deconv1_b
loaded deconv_bn1_beta
loaded deconv_bn1_gamma
loaded aux_classifier_W
loaded aux_classifier_b
loaded declstm_ifog_W
loaded declstm_ifog_b
loaded declstm_ln_beta
loaded declstm_ln_gamma
loaded classifier_W
loaded classifier_b
loaded bn1_mean
loaded bn1_inv_std
loaded bn2_mean
loaded bn2_inv_std
loaded bn3_mean
loaded bn3_inv_std
loaded bn4_mean
loaded bn4_inv_std
loaded bn5_mean
loaded bn5_inv_std
loaded deconv_bn5_mean
loaded deconv_bn5_inv_std
loaded deconv_bn4_mean
loaded deconv_bn4_inv_std
loaded deconv_bn3_mean
loaded deconv_bn3_inv_std
loaded deconv_bn2_mean
loaded deconv_bn2_inv_std
loaded deconv_bn1_mean
loaded deconv_bn1_inv_std
Traceback (most recent call last):
  File "/usr/local/bin/flask", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/flask/cli.py", line 966, in main
    cli.main(prog_name="python -m flask" if as_module else None)
  File "/usr/local/lib/python2.7/dist-packages/flask/cli.py", line 586, in main
    return super(FlaskGroup, self).main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/flask/cli.py", line 848, in run_command
    app = DispatchingApp(info.load_app, use_eager_loading=eager_loading)
  File "/usr/local/lib/python2.7/dist-packages/flask/cli.py", line 305, in __init__
    self._load_unlocked()
  File "/usr/local/lib/python2.7/dist-packages/flask/cli.py", line 330, in _load_unlocked
    self._app = rv = self.loader()
  File "/usr/local/lib/python2.7/dist-packages/flask/cli.py", line 388, in load_app
    app = locate_app(self, import_name, name)
  File "/usr/local/lib/python2.7/dist-packages/flask/cli.py", line 240, in locate_app
    __import__(module_name)
  File "/content/sentence-space/textproject_server.py", line 143, in <module>
    from_z = decoder_from_z(x) #sampled.astype(theano.config.floatX))
  File "/content/sentence-space/nn/containers.py", line 11, in __call__
    x = layer(x)
  File "/content/sentence-space/nn/layers1d.py", line 180, in __call__
    conved = dnn.dnn_conv(image, w, subsample=(self.stride, 1), border_mode=(self.pad, 0))
  File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/cuda/dnn.py", line 1176, in dnn_conv
    kerns = gpu_contiguous(kerns)
  File "/usr/local/lib/python2.7/dist-packages/theano/gof/op.py", line 615, in __call__
    node = self.make_node(*inputs, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/cuda/basic_ops.py", line 3910, in make_node
    input = as_cuda_ndarray_variable(input)
  File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/cuda/basic_ops.py", line 46, in as_cuda_ndarray_variable
    return gpu_from_host(tensor_x)
  File "/usr/local/lib/python2.7/dist-packages/theano/gof/op.py", line 615, in __call__
    node = self.make_node(*inputs, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/cuda/basic_ops.py", line 132, in make_node
    dtype=x.dtype)()])
  File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/cuda/type.py", line 95, in __init__
    (self.__class__.__name__, dtype, name))
TypeError: CudaNdarrayType only supports dtype float32 for now. Tried using dtype float64 for variable None
Exception TypeError: TypeError("'NoneType' object is not callable",) in <bound method _NonClosingTextIOWrapper.__del__ of <_io.TextIOWrapper encoding='UTF-8'>> ignored

sentencepiece.py directs to your original sp model folder - how to change path?

Hi:

Have everything installed but when I run 'bash serve.sh' it returns this error:

File "/usr/local/lib/python2.7/dist-packages/sentencepiece.py", line 118, in Load
return _sentencepiece.SentencePieceProcessor_Load(self, filename)

IOError: Not found: Cannot open /home/robin/dev/water-margin/sp/sf256.model
Exception TypeError: TypeError("'NoneType' object is not callable",) in <bound method _NonClosingTextIOWrapper.del of <_io.TextIOWrapper encoding='UTF-8'>> ignored

Opened sentencepiece.py but line 118 doesn't contain the path?

Also script contains this commented warning:

This file was automatically generated by SWIG (http://www.swig.org).

Version 3.0.10

Do not make changes to this file unless you know what you are doing--modify

the SWIG interface file instead.

Any ideas on how to change the path?

Thanks

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.